How to calculate the load time, max - min date query

  CREATE TABLE TEST ( GID VARCHAR2(100 BYTE), SGID VARCHAR2(100 BYTE), PID VARCHAR2(100 BYTE), DATES TIMESTAMP (6) );

REM INSERTING into TEST
SET DEFINE OFF;
Insert into TEST (GID,SGID,PID,DATES) values ('1','1000','ABC',to_timestamp('24-AUG-13 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('1','1001','BCD',to_timestamp('24-AUG-13 05.21.46.491000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('1','1002','CDE',to_timestamp('24-AUG-13 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('2','1004','EDF',to_timestamp('23-AUG-13 05.22.20.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('2','1003','FEG',to_timestamp('24-AUG-13 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('2','1001','GHI',to_timestamp('24-AUG-13 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('2','1006','JKL',to_timestamp('24-AUG-13 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('3','1007','LMN',to_timestamp('24-AUG-13 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
Insert into TEST (GID,SGID,PID,DATES) values ('3','1001','OPQ',to_timestamp('24-AUG-13 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));

Hello

I need a sql query which gives me the time taken to load the records ie., Max date less date min. I ran a query that gives me the result "0 23:59:26.491" below.

select (max(DATES) - min(DATES)) from test;

When I apply the same logic in Peoplesoft enterprise manager, it generates the sub query and throw me the "ORA-01722: invalid number" error.

select max(TO_CHAR(cast((DATES) as timestamp),'YYYY-MM-DD-HH24.MI.SS.FF'))
-min(TO_CHAR(cast((DATES) as timestamp),'YYYY-MM-DD-HH24.MI.SS.FF'))
from test; 

Can you please modify the above query?

user11872870 wrote:

  1. CREATE TABLE TEST (VARCHAR2(100 BYTE), VARCHAR2(100 BYTE), PID VARCHAR2 (100 BYTE) SGID GID, DATES TIMESTAMP (6));
  2. INSERTION of REM in TEST
  3. TOGETHER TO DEFINE
  4. Insert into TEST (GID, SGID, PID, DATES) values ('1 ', ' 1000', 'ABC', to_timestamp (12.00.00.000000000 AM Aug 24, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  5. Insert into TEST (GID, SGID, PID, DATES) values ('1 ', ' 1001', "BCD", to_timestamp (24 August 13 05.21.46.491000000 PM ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  6. Insert into TEST (GID, SGID, PID, DATES) values ('1 ', ' 1002', "COE", to_timestamp (12.00.00.000000000 AM Aug 24, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  7. Insert into TEST (GID, SGID, PID, DATES) values ('2 ', ' 1004', "EDF", to_timestamp (05.22.20.000000000 PM Aug 23, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  8. Insert into TEST (GID, SGID, PID, DATES) values ('2 ', ' 1003', "FEG", to_timestamp (12.00.00.000000000 AM Aug 24, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  9. Insert into TEST (GID, SGID, PID, DATES) values ('2 ', ' 1001', 'GHI', to_timestamp (12.00.00.000000000 AM Aug 24, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  10. Insert into TEST (GID, SGID, PID, DATES) values ('2 ', ' 1006', 'JKL', to_timestamp (12.00.00.000000000 AM Aug 24, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  11. Insert into TEST (GID, SGID, PID, DATES) values ('3 ', ' 1007', "LMN", to_timestamp (12.00.00.000000000 AM Aug 24, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));
  12. Insert into TEST (GID, SGID, PID, DATES) values ('3 ', ' 1001', "Professions", to_timestamp (12.00.00.000000000 AM Aug 24, 13 ',' DD-MON-RR HH.MI.)) SS. AM FF '));

Hello

I need a sql query which gives me the time taken to load the records ie., Max date less date min. I ran a query that gives me the result "0 23:59:26.491" below.

  1. Select (max (DATES) - min (DATES)) of the test;

When I apply the same logic in Peoplesoft enterprise manager, it generates the sub query and throw me the "ORA-01722: invalid number" error.

  1. Select max (TO_CHAR (cast ((DATES) as timestamp),'YYYY-MM-DD - HH24.MI.)) SS. FF'))
  2. -min (to_char (Cast ((dates) as timestamp),'YYYY-MM-DD - HH24.MI.)) SS. FF'))
  3. of the test;

Can you please modify the above query?

  1. SELECT max (cast (DATE) as date)-mIN (cast (DATE) as date) test;

Tags: Database

Similar Questions

  • How to calculate the loading time of BDB startup

    Hi all

    I understand that Berkeley DB at startup it will read a few pages from the disk in the memory cache, but I don't know the exact number of pages that will load. I think that BDB will load default pages as much as possible in the cache until the cache is full. Is this good?

    And how to calculate the cost of time on the loading process? Can it be verified using db_stat?

    Thank you very much

    Hello.

    There is a discussion on how proceed (preload the cache) in this thread:
    Re: a question about read file or cache

    Ben Schmeckpeper

  • How to calculate the execution time of a SCTL in FPGA VI?

    Hello

    Can someone guide me that how to calculate the execution time of a SCTL for an iteration in the FPGA VI?

    Thank you and best regards,

    Rashid

    Hello r,.

    A SCTL will always run in a beat the clock it has been linked to.  So, if you use a 40 MHz clock, this loop will run in 25 ns.  If the code cannot complete in that, or if it requires two graduations of the watch to do the calculation, your code does not compile, then you have the guarantee that this will always be how long it takes this piece of code to run.

  • How to calculate the execution time of a loop?

    Hello

    Can someone guide me that how to calculate the execution time of a loop to iterate?

    Thank you and best regards,

    Rashid

    I hope I have your question! See attached screenshot

  • How to display the loading time of the page?

    Hello

    I would like to know how to display the loading time of the page? I know there is a var that must be in the footer, but I don't remember.




    Thanks in advance
    Antonio

    >
    You can use #TIMING # footer region the region to display the time taken to make this region - not sure about a whole page of
    >
    How about this the understands it in the front page template header...

    
    

    And then this in a div in the footer of the page template...

    
    

    See you soon

    Ben

  • How to calculate the number of days between dates

    How can I determine the number of days between 2 dates? Say today and 10/07/46

    Thanks Bob

    You could do it like this:

    Photoperiod var = 1000 * 60 * 60 24; number of ms in a day

    var today: Date = new Date();

    var every time that: Date = new Date (1946,6,10);

    var diff = Math.floor((today.getTime()-whenever.getTime())/dayLength);

    trace (diff)

  • How to calculate the polynomial graphic adjustment of waveform

    Hi all

    I am new to lab - view so would need a little assistance in one of the problem I have right now.

    My problem is: how to calculate the polynomial graph of waveform data adjustment? I need to convert the waveform to XY graph data, and then use the polynomial vi made integrated to calculate the fitting?

    Detail: My problem is that I have waveform graph, I calculate the vertices and the Valley, but because of the noise, my peaks and Valley detection is sometimes not exact, so to smooth the chart that I must apply the polynomial fit.

    If anyone can help me in this, I'll be very grateful.

    Thanks in advance

    Hi Omar,.

    have you seen the suggestion of Lynn above?

    You already have the values of Y (your table). Now, you need build the table of X as indicated, only to replace the value of dt with your spacing from point to point. Somewhere in your code, you know that the value that you have an x-axis indicated in milliseconds...

  • How can I calculate the total time in java?

    Hello!

    I need to calculate the total time!

    For example I start time:
    Format formatter1;
    Date date1 = new Date();
    formatter1 = new SimpleDateFormat("hh:mm:ss");
    Dim startTime = formatter1.format (date1);
    startTime = "14:20:40.

    And I have finishing time:
    Format formatter2;
    Date2 date = new Date();
    formatter2 = new SimpleDateFormat("hh:mm:ss");
    String finishTime = formatter2.format (date2);
    finishTime = '08:30:55;



    Also, having calculated manually, I get the total time: '18:10:15.

    How can I calculate the total time in java? (Using formatter1 and formatter2 I guess)

    What I need is to print 'total 18:10:15 '.

    Thank you!

    800512 wrote:
    I did the following, but I think something's wrong here:

    I've defined before: Date date1 = new Date(); Date2 date = new Date();
    And it should be exactly 5 seconds between them.

    I found the delta between date1 and date2:

    Format formatter = new SimpleDateFormat("HH:mm:ss");
    timeInMilliFromStart long = date1.getTime () - date2.getTime ();
    Date date3 = new Date (timeInMilliFromStart);
    String timeInSecFromStart = formatter.format (date3);

    and I still get
    timeInSecFromStart = 02:00:05

    But it should be exactly 00:00:05.

    What is a problem?

    Because, as I said, a Date to measure a moment in time, not a period. So when you have 5000 ms, and you that transform a Date, this means that 5 seconds after the time, which equals 00:00:05.000 01/01/1970 GMT.

    As I said, if you are not currently in GMT, then you must set the DateFormat GMT TZ. Right now, it's to show you the time in your TZ. If you have included the date in your SimpleDateFormat, you would see the 01/01/1970 or 31/12/1969, function that TZ you find.

    Bottom line: you try to use these classes in a sense they are not intended for, and while you can get the results you want for a limited set of entries if you understand how these classes and how to work with it, it is a fragile approach and comes with all sorts of warnings warning.

  • How can I speed up the load time of my site?

    Hello

    How can I speed up the load time of my site hosted on BusinessCatalyst.

    http://www.PW-energy.co.UK

    Is there a way to compress?

    Any help much apprecated.

    Thank you

    Hello

    The page/site seems to load very well at the moment.

    However if want to inspect what could slow down the loading of your page I recommend using 'firebug' and select the 'network' tab to follow every chronology file loading.  Then you can see which file takes more time to load to help make adjustments accordingly.

    http://getfirebug.com/

    Kind regards

    -Sidney

  • How to calculate the time to SELECT

    I want to know how to calculate the time taken by the SELECT query.

    For example: I run a select statement in TOAD (oracle version 9i) who takes 40 seconds to run, but in the output window, it displays few records. It says "list 1 of 500 records, more records exist". This table has total 20 million records.

    Now my question is: have you my SELECT query took 40 seconds? or it took 40 seconds to SELECT 500 records.

    If it took 40 seconds to SELECT 500 records then how to calculate the total amount?

    Any help would be much appreciated.

    To avoid the exit which is probably not really need you can make

    begin
      for c in (select * from xy /*your query */)
      loop
        null;
      end loop;
    end;
    /
    

    This gives an estimate of the time to recover all the lines.

  • The loading time of a Web page takes about 30 seconds. How can I improve this

    It comes to this page: http://www.barronstudio.nl/hoogstraat-2-bergen-op-zoom.html

    Hello CreativeBarron,

    I checked your site at my end and observed that you used several large images in Muse that contributes to the load time. Please look at the screenshot below.

    By reducing the size of these images, you can certainly reduce the loading time of the site.

    Kind regards

    Vivek

  • How to calculate the second and minisecond for audio landmark

    I'm doing a sound synchronization for the clip audio and video in Flash. I found a tutorial on the web, and it seems to work. However, I do not know how to calculate the second and the mini (deuxieme from mp3 file. The first frame has the following lines to set the duration for each animation:
    Import class
    Import net.quip.sound.SoundSync;

    Stop the main timeline
    Stop();

    Create an instance of SoundSync
    var ss:SoundSync = new SoundSync();

    ss.addCuePoint ("IT", 20100);
    ss.addCuePoint ("admin", 20000);
    ss.addCuePoint ("maintenance", 19800);
    ss.addCuePoint ("treatment", 16479);
    ss.addCuePoint ("engineering", 14598);
    as.addCuePoint ("logo_epa_npdes", 12356);
    ss.addCuePoint ("construction", 8967);
    ss.addCuePoint ("370 mg/j", 7896);
    ss.addCuePoint ("mc_650, 000 ', 5439);
    ss.addCuePoint ("130 mg/j", 3254);
    ss.addCuePoint ("1938", 2439);
    ss.addCuePoint ("vintage_mc", 0);

    Use the instance of loading external MP3
    ss.loadSound ("Scn04 - 05.mp3", true);

    Create a listener object for the
    cuePoint and onSoundComplete events
    var listener: Object = new Object();
    listener.cuePoint = function (): Void {}
    Play();
    }
    listener.onSoundComplete = function (): Void {}
    Play();
    }
    ss.addEventListener ("cuePoint", listener);
    ss.addEventListener ("onSoundComplete", listener);

    and the soundsync.as file as follows:
    Import mx.events.EventDispatcher;
    Import mx.utils.Delegate;
    class net.quip.sound.SoundSync extends its {}
    PROPERTIES
    private var _cuePoints:Array;
    private var _currentCuePoint:Number;
    private var _interval:Number;
    private var _intervalDuration:Number;
    private var _secondOffset:Number;
    Event dispatcher
    public var dispatchEvent:Function;
    public var addEventListener:Function;
    private var removeEventListener:Function;
    CONSTRUCTOR
    public void SoundSync(target:MovieClip) {}
    Super (target);
    init();
    }
    METHODS
    private function init (): Void {}
    Initialize properties
    _cuePoints = new Array();
    _currentCuePoint = 0;
    _intervalDuration = 200;
    _secondOffset = 0;
    Initialize the instance of the class as the valid event broadcaster
    EventDispatcher.initialize (this);
    }
    Add Cue Point
    public void addCuePoint(cuePointName:String,_cuePointTime:Number):Void {}
    () _cuePoints.push
    {
    type: "cuePoint",.
    name: cuePointName,.
    time: cuePointTime,.
    target: this
    }
    );
    _cuePoints.sortOn ("time", Array.NUMERIC);
    }
    Get cue point
    public void getCuePoint(nameOrTime:Object):Object {}
    var counter: Number = 0;
    While (counter < _cuePoints.length) {}
    If (typeof (nameOrTime) == 'string') {}
    If (_cuePoints [meter] .name == nameOrTime) {}
    return _cuePoints [counter];
    }
    } Else if (typeof (nameOrTime) == 'number') {}
    If (_cuePoints [meter] .time == nameOrTime) {}
    return _cuePoints [counter];
    }
    }
    counter ++;
    }
    Returns a null value.
    }
    Get the Index of the current Cue Point
    private void getCurrentCuePointIndex(cuePoint:Object):Number {}
    var counter: Number = 0;
    While (counter < _cuePoints.length) {}
    If (_cuePoints [meter] .name == cuePoint.name) {}
    return the meter;
    }
    counter ++;
    }
    Returns a null value.
    }
    Get the next Cue Point index
    private void getNextCuePointIndex(seconds:Number):Number {}
    seconds (seconds) =? seconds: 0;
    var counter: Number = 0;
    While (counter < _cuePoints.length) {}
    If (_cuePoints [meter] .time > = seconds * 1000) {}
    return the meter;
    }
    counter ++;
    }
    Returns a null value.
    }
    Benchmark deleted
    public void removeCuePoint(cuePoint:Object):Void {}
    _cuePoints.splice (getCurrentCuePointIndex (cuePoint), 1);
    }
    Remove all Cue Points
    public function removeAll_cuePoints (): Void {}
    _cuePoints = new Array();
    }
    Beginning
    public void start(secondOffset:Number,_loops:Number):Void {}
    Super.Start (secondOffset, loops);
    dispatchEvent ({type: "onStart", target: this});
    Reset benchmark
    _secondOffset = secondOffset;
    _currentCuePoint = getNextCuePointIndex (secondOffset);
    Poll for cue points
    clearInterval (_interval);
    _interval = setInterval (Delegate.create (this, pollCuePoints), _intervalDuration);
    }
    Load sound
    public void loadSound(url:String,_isStreaming:Boolean):Void {}
    super.loadSound (url, isStreaming);
    clearInterval (_interval);
    _interval = setInterval (Delegate.create (this, pollCuePoints), _intervalDuration);
    }
    Stop
    public void stop(linkageID:String):Void {}
    If {(linkageID)
    Super.Stop (linkageID);
    } else {}
    Super.Stop ();
    }
    dispatchEvent ({type: "onStop", target: this});
    Kill the ballot
    clearInterval (_interval);
    }
    Survey benchmarks
    private function pollCuePoints (): Void {}
    If the current position is close to the cue point.
    var time: Number = _cuePoints [_currentCuePoint] .time;
    var span: Number = (_cuePoints [_currentCuePoint + 1] .time)? _cuePoints [_currentCuePoint + 1] .time: time + _intervalDuration * 2;
    If (position > = time & & position < = span) {}
    Send event
    dispatchEvent (_cuePoints [_currentCuePoint]);
    Advance to the next landmark...
    If (_currentCuePoint < _cuePoints.length) {}
    _currentCuePoint ++;
    } else {}
    _currentCuePoint = getNextCuePointIndex (_secondOffset);
    }
    }
    }
    EVENT HANDLERS
    onSoundComplete
    public function onSoundComplete (): Void {}
    Kill the ballot
    clearInterval (_interval);
    Reset benchmark
    _currentCuePoint = 0;
    Send event
    dispatchEvent ({type: "onSoundComplete", target: this});
    }
    }

    any help will be greatly appreciated.

    Wuzhishan,

    > Hi Dave, your tutorial is very cute and it is very useful.

    Thank you! My daughter is cute. She inherited all of
    me, so I have not left. ;)

    > I'm sorry that I don't have my question clearly.

    No worries. :)

    > I have listen mp3 in Windows Media Player and try to
    > get both for the tail, I found it on the bottom of the
    > player time indicates 00:26.

    I'm with you.

    > How can I writer this number in the code? Is it 0026 or 26?

    The code expects milliseconds, then 26 seconds would be written as
    this:

    26000

    If he said 01:22 (one minute and 22 seconds), you must write it like this:

    82000

    ... which is 60 seconds for now, 22 seconds
    side, then multiplied by 1,000 to get milliseconds.

    David Stiller
    Adobe Community Expert
    Dev blog, http://www.quip.net/blog/
    "Luck is the residue of good design."

  • How to calculate the length of the video format (seconds)

    Hello

    I use the ActionScript 3.0 CookBook book and it shows how to calculate the length of a video (and also playing the video in progress) in seconds using the property at the time of the NetStream class.

    So, for example, the length of my video is 1070 seconds.

    But I want to be able to convert a format such as ' 00 (hours): 00 (mins): 00 (dry) ", '1070 seconds' how can I get this?

    Any help is appreciated!

    TA :)

    Kind regards
    M.

    Hi, thanks for the reply :) you have helped me understand the following code which I just found (and that seemed to work the way I needed it).

    Quote:

    If (_duration > 0 & _stream.time > 0)
    {
    _playbackTime.text = generateTime (_stream.time);
    }

    function generateTime(nCurrentTime:Number):String
    {
    var nMinutes:String = (Math.floor(nCurrentTime / 60)< 10="" "0"="" :="" "")="" +="" math.floor(ncurrenttime="">
    var nSeconds:String = (Math.floor (nCurrentTime % 60)< 10="" "0"="" :="" "")="" +="" math.floor(ncurrenttime="" %="">

    Result set
    var sResult:String = nMinutes + ":" + nSecondes;

    Return value
    return sResultat;
    }

  • How to calculate the ckptLogVolume?

    Hello:
    I have a question about control, our policy of ckeckpoint is 10 minutes or volume of data has come up to 1 G, but from the ckpthistory, we can see sometimes it does not respond to volume 10 minitues or 1 G. How to calculate the ckptLogVolume? If we see the result ckpthistory? If possible, which column? Thank you...

    call ttCkptConfig;
    < 600, 1024, 0 >

    call ttckpthistory;
    < 15:26:50.539519 2009-05-15, 2009-05-15 15:26:55.524454, fuzzy, completed, Checkpointer, < NULL >, 1, 99, 247909568, 82508, 4294967296, 81197, 1750236928, 15457, 301826504, 327339272, < NULL > >
    < 15:17:20.577626 2009-05-15, 2009-05-15 15:17:20.857039, static, final, Subdaemon, < NULL >, 0, 97, 242211472, 81004, 4294967296, 79563, 1686897608, 20, 1573232, 1618112, < NULL > >
    < 15:16:49.203124 2009-05-15, 2009-05-15 15:16:55.300502, static, final, Subdaemon, < NULL >, 1, 97, 242211320, 81004, 4294967296, 79563, 1686897608, 13070, 280099880, 239440672, < NULL > >
    < 15:16:21.659487 2009-05-15, 2009-05-15 15:16:28.507656, static, final, Subdaemon, < NULL >, 0, 97, 242211168, 81004, 4294967296, 79563, 1686897608, 14441, 307440952, 265360008, < NULL > >
    < 15:11:38.139007 2009-05-15, 2009-05-15 15:11:43.322764, fuzzy, completed, Checkpointer, < NULL >, 1, 96, 80730544, 81450, 4294967296, 80193, 1726321176, 14842, 308879240, 321674504, < NULL > >
    < 15:08:18.118181 2009-05-15, 2009-05-15 15:08:23.100922, fuzzy, completed, Checkpointer, < NULL >, 0, 94, 79302232, 81558, 4294967296, 80382, 1737702968, 15017, 311253288, 334736648, < NULL > >
    < 15:05:00.002139 2009-05-15, 2009-05-15 15:05:05.081461, fuzzy, completed, Checkpointer, < NULL >, 1, 92, 76043440, 81559, 4294967296, 80386, 1737962016, 15053, 311957568, 335301896, < NULL > >
    < 15:01:41.882166 2009-05-15, 2009-05-15 15:01:46.959502, fuzzy, completed, Checkpointer, < NULL >, 0, 90, 74032552, 81594, 4294967296, 80425, 1740156304, 15008, 311831160, 337583368, < NULL > >

    Checkpopint operations which are drivern by the volume of interval and log checkpoint are those that are 'Checkpointer' in the output of ttCkptHistory. Control points can also occur for other reasons, for example when the data store is stopped, when it is loaded in memory and recovery is necessary. These kinds of control point are marked as "Static" and "Subdaemon". You can see three of those in the output.

    The output, it seems you're checkpointing about every 4 minutes. Assuming the target settings (interval 600 seconds, Journal volume of 1 GB) were already in place at the time of these control points has occurred then it seems that all of these were led by the volume of the journal rather than the checkpoint interval (that you generate ~ 1 GB of log about every 4 minutes).

    Chris

  • To build the waveform.vi function how to calculate the value of dt

    Dear all

    Please guide me How to calculate the value of dt according to waveform.vi of construction

    My sampling rate is 25000 and I take 200000 samples.

    Kind regards

    Muhammad Irfan

    It's all simple arithmetic. The inverse of the sampling frequency power of samples is then the dt or the time between samples the number of samples is not relevant.

Maybe you are looking for