How to obtain a number of seconds between 2 fields in TimeStamp datatypa

Hello, I need to have the result of a difference between 2 fields (date1 - date2)which are in TimeStamp datatype
The result given must be in seconds
I am using owb 10.2.1.0.31
Can so help me ?
Thanks

check the Puget Sound Oracle Users Group page (http://www.psoug.org/) at
http://www.psoug.org/reference/timestamp.html
And more information on the INTERVAL DAY TO SECOND datatype at
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#SQLRF00207
here's an excerpt from the PSOUG page:
CREATE TABLE tint_test (
msg VARCHAR2(25),
start_date TIMESTAMP WITH TIME ZONE,
end_date TIMESTAMP WITH TIME ZONE,
duration_1 INTERVAL DAY(5) TO SECOND,
duration_2 INTERVAL YEAR TO MONTH);
INSERT INTO tint_test
(msg, start_date, end_date)
VALUES
('my plane ride',
timestamp'2004-08-08 17:02:32.212 US/Eastern',
timestamp'2004-08-08 19:10:12.235 US/Pacific');
UPDATE tint_test
SET duration_1 = (end_date - start_date) DAY(5) TO SECOND,
duration_2 = (end_date - start_date) YEAR TO MONTH;
SELECT msg, duration_1, duration_2 FROM tint_test;
SELECT t.*, end_date - start_date FROM tint_test t;

Similar Messages

  • How to set the number of seconds a servlet is allowed to run

    I use JSP to generate a report, but it will take about 10 minutes to search.
    IE Client screen displays an error message what is "Cannot find out your page" after 8 minutes. How to set the number of seconds a servlet is allowed to run.

    It's not a matter of how long the servlet is running... it's the browser timing out because the servlet hasn't responded to its request.
    You have several options:
    1) "Browser Pinging"
    Your servlet sends some small data which can be either seen or unseen (html comments, hidden chars, etc) by the user at short intervals while your report is running. When the report is finished, the browser will not have timed out because it has been "snacking" on those small bits of data which tell the browser its original request was both heard and being handled. I don't think there is any timeout in IE as long as it receives data continually (or at least before its own timeout mark over and over again...)
    2) Multithreaded processing
    This would probably be a better approach. Have the report run in a separate thread running on the server. You'd want to store a reference to this executing report in the user's session. Instead of making the browser wait for the report to be finished, have the servlet check the user's session to see if a report exists and is running. If one does not exist, create one and start its execution. If one does exist, and is still running, print a "please wait" type of message OR an animation, etc... along with some javascript which will reload the page every few seconds. If the page reloads and the servlet sees that the report is finished, it can then display it to the user.
    Hope this helps,
    -Scott

  • How do obtain the number words typed in a Pages document?

    How do obtain the number words typed in a Pages document?

    I found it!  To get the number of words in my Pages 5.1 document...I clicked on the paper-icon on the far left...(at the very left edge) it gave me a selection that ended with "count words."  TaDa!  Thanks

  • How generate a random number that is between 0 and 15! (0-15)

    how generate a random number that is between 0 and 15 ??? (0-15)
    pls tell me, thx!!!!!!!!!!!!!!!!!

    import java.util.Random;
    Random r = new Random();
    int mynumber = r.nextInt()%16;
    For (2^1)-1 number use:
    -> int mynumber = r.nextInt()&15; // speedup

  • How do i get number of days between 2 dates?

    How do i get number of days between 2 dates?
    and the result must be in int.
    for example
    Ex. startdate: 2006-06-01 enddate: 2006-06-30 and the result is: 30
    how to do so? thx

    mel
    Iv'e used this method. It assumes startdate,enddate and days have been defined before but you could pass them as args.
    void days()
        try
          Date d1 = DateFormat.getDateInstance().parse(startdate);
          Date d2 = DateFormat.getDateInstance().parse(enddate);
          long days = (d2.getTime()-d1.getTime())/1000/60/60/24;
          days = ""+days;
        catch (ParseException e)
          System.out.println("Invalid date format");
      }It actually gets the duration in ms and divides down to days.
    Regards
    Chris

  • How  can I get number of days between 2 dates ?

    How can I get number of days between 2 dates ?
    Give me answer as soon as possible.....

    Mukesh_Prajapat wrote:
    How can I get number of days between 2 dates ?
    Give me answer as soon as possible.....Is google broken again?
    [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html]

  • How can i get number of days between two dates represented by two dates?

    how can i get number of days between two dates represented by two date objects. One is java.sql.Date, the other is java.util.Date?

    tej_222 wrote:
    But how do I do that conversion. from java.sql.date and java.util.date to calender?
    -thanks for the quick response.You may find the following utility code samples useful:
    [http://balusc.blogspot.com/2007/09/calendarutil.html]
    [http://balusc.blogspot.com/2007/09/dateutil.html]
    ganeshmb wrote:
    (date1.getTime() - date2.getTime())/(1000*60*60*24) should do.
    getTime returns millsecond value of date object and the difference divided by no of milliseconds in a day should fetch you the difference in terms of days.This doesn't respect the DST. Use java.util.Calendar.

  • How to get the number of days between 2 given dates

    Hi all,
    How can I find the number of days between any 2 given dates.
    Thanks

    Hi
    Here's a dirty way:
    If you've got two Date objects in Java, call getTime() on each one (which gives you a value in milliseconds), then subtract the two millisecond values, and divide the result by the number of milliseconds in a day (24 * 60 * 60 * 1000). There's more `elegant' ways to do this, but this method only requires one line of Java.
    Best wishes
    Kevin

  • How to set the number of seconds (or time) a photo is displayed on a slideshow (ATV2)

    Can I set the number of seconds a photo stays on the TV screen when I  do a slideshow from my ATV2?   Can't seem to find a setting on the Apple TV to do that.   For the slideshow on the ATV2 I am choosing an Event from my iPhoto library and then choosing "slideshow" after adjusting the ATV2 settings for music and theme.

    You can only set the time of slides with certain types of slideshows (i.e. classic and ken burns)

  • How to reduce the number of exchange between the database & the app?

    Hi,
    In order to resolve performance issue of my application under a dirty network (ping=150ms), I make use of Ethereal.
    And I noticed that an incredible amount of TCP exchanges (little SQL requests amoung others things) was complete between my application and the database.
    Does exist a KODO or JDO parameter upon which I could work around in order to optimize these exchanges/SQL requests?
    DB: Oracle 9.2.0.1 --
    KODO: 3.3.3 --
    Thanks a lot.
    Mathieu, STERIA France
    Message was edited by:
    steria_fr
    Message was edited by:
    steria_fr

    You can activate logging of every SQL being issued by Kodo by setting kodo.Log:SQL=TRACE.
    Kodo issues SQL when the application accesses object fields/relations that are not yet loaded. Analysis of SQL would indicate what is being fetched. You can minimize the number of SQL, say, adding a set of fields in the same fetch-group thereby bringing them from database in a single SQ!L call.

  • How to obtain row number when a new row is created (without commit)?

    I have this:
    <NamedData NDName="LineaNro"
    NDValue="#{bindings.VOIpmDistribucionManualEBS1.currentRowIndex}"
    NDType="oracle.jbo.domain.Number"/>
    When I push the New button, the value shows -1. If I push again, the value shows 0... but for third time an error occur:
    Too many objects match the primary key oracle.jbo.Key[0 0 2011-12-01 ID del comprobante 0 ]
    The problem is the last 0, it's the same 0 returned for the second button push.
    The commit must be do it at the end.
    Any suggestions?
    Thanks in advance.

    Can you elaborate a bit on what you are trying to do?
    And which jdev version you are using?
    If you try to use the current row index a a primary key for a new row this won't work. The first time you hit the new button you get -1 as the current row is not set. Then the new row get the current row and get the index 0. So, then you hit new again you get 0 back.
    It's never a good idea to use a row index as primary key as this won't work in multi user environments (which adf web apps are).
    You should use a db sequence as PK as this will work in all scenarios and guarantees that one number is only use once.
    Timo

  • How to calculate the number of months between two string as yyyymm

    Dear all,
    I have two month string like yyyymm e.g. 201003 -- 201105. Now I want to calculate the number of months bertween these two month string? How can I do that? Thanks.

    888099 wrote:
    Hi,
    Hope this will help :
         public static void main(String[] args) {
              Calendar cal1 = new GregorianCalendar(2010, 02, 01);
              Calendar cal2 = new GregorianCalendar(2011, 04, 01);
              int years = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
              int months = cal1.get(Calendar.MONTH) - cal2.get(Calendar.MONTH);
              System.out.println("number of months : "+Math.abs(years*12 + months));
         }Or with only Strings :
         public static void main(String[] args) {
              String s1 = "201002";
              String s2 = "201104";
              int years = Integer.valueOf(s1.substring(0,4)) - Integer.valueOf(s2.substring(0,4));
              int months = Integer.valueOf(s1.substring(4)) - Integer.valueOf(s2.substring(4));
              System.out.println("number of month : "+Math.abs(years*12 + months));
         }Edited by: 888099 on 28 sept. 2011 05:49Full code solutions will not help the OP, he will be back here with a different Date question. Posters here try to nudge the OP to figure out the solution himself.

  • How to obtain object number using cost center??

    hI.
    i need to obtain all the cost elemnts of a particular cost center..
    cost elemnt can b fetched from COSP using OBJNR..
    How do i obtain OBJNR using KOKRS,KOSTL????

    Hi
    From the table
    CSSK
    take the related Cost elements for a cost center.
    Concatenate the cost element with KS and other Orgn unit
    and pass to the Costing tables
    see an entry in those tables you will know what are the fields in OBJNR that are concatenated
    Reward points if useful
    Regards
    Anji

  • How to Obtain Batch Number

    Dear Members,
    How  can i obtain the selected Batch details , before adding the A/R Invoice document.?
    Its not updated or stored in OIBT Table also before adding the A/R Invoice document.
    Help will be appreciated to solve this issue.
    Thanks and Regards,
    Tamizharasi.S

    Hi,
    You're right. Batch Info is not saved to DB after selection.
    However, Batch Info can be accessed as below:
    1.Retrieve the selected batch in matrix when click "Update" button on Batch Selection
    and store it as an static array
    2.When A/R invoice form is activated again after batch selection.You can access the batch info from array.
    Do what you want.
    Regards, Yatsea

  • How to obtain the number of words of a protected pdf file that can't be converted into a word file?

    I need to get the number of words of pdf files. I usually convert them into word files to get the word count. Some pdf files are protected and can't be converted into word files. Is there another way to get the number of words of these protected pdf files? I use adobe professional XI Pro.

    Scroll through and read the answers available in the thread below. You may find the information helpful.
    Trying to write Javascript code to get word count
    Be well...

Maybe you are looking for