SELECT ROWNUM and ORDEY BY DATE

I want to select the most recent row from a table where one column is null and have the following query.
'select * from table_name where rownum < 2 and column1 is null order by date_stamp desc'
Date_stamp column holds the system date when each row was inserted int this table. So whenever a row is insered into this table the date_stamp column always gets the curent sysem date.
This is always returning me the oldest row not the most recent row. I tried to use
GREATEST(select date_stamp from table_name)
but it did not work as GREATEST expects dats seprated by commas.
If there is a function which can convert the date_stamp to a numerical value(milliseconds from 1970 or something like what java has) I can order by that number and the most recent date should have the highest numerical value and thus should work.
Is there a way to do this without having to write a procedure or function? I'm using 8i(8.1.7).
Thanks

Note that ORDER BY and ROWNUM cannot be combined the way you have in your query. Try this:
SELECT *
FROM   (SELECT *
        FROM   table_name
        WHERE  column1 IS NULL
        ORDER  BY date_stamp DESC)
WHERE  rownum = 1

Similar Messages

  • In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    The query is re-issued as a flashback query and the client process can continue to fetch from the cursor. This is described in the Net Services Administrators Guide, the section on Transparent Application Failover.

  • How do I select range and require end date in it crystal report

    I'm trying to select a range of dates in my records however it must include the end date from my parameters what is the syntax for that record selection and anything after the Start Date (open).  If the Date range doesn't end in the specified End Date then I don't want to see it.

    well I created two reports one with pulling all the end dates data then the other report with the stuff before that date and put the end date as a subreport in the other one so he can see what was done recently on the subreport and scroll through the other report while the subreport stays on the results bottom end - however he has to scroll through 100's of pages to find the data he wants so he doesn't like that. However it is a good mockup of the results he wants ...but he doesn't want to scroll through 100's of pages - my guess is he wants one report with end date only and any dates before hand.
    Original
    Part                         TransactionDate                         Qty                     Unit cost
    GA101                    10/11/2013                                  5                         1.23
    GA101                    5/25/2012                                   10                        2.23   
    GA101                    8/14/2011                                   15                        5.15
    HE8924                  8/22/2014                                   14                        4.25  
    HE8924                  6/13/2012                                   2                          3.25
    UY325                    8/22/2014                                   5                         6.32
    UY325                    7/10/2010                                   2                         3.25
    TE5689                  8/12/2014                                   1                          8.14
    TE5689                  5/16/2013                                   2                          9.12
    IO8978                    8/22/2014                                   6                         8.25
    IO8978                    5/20/2013                                   8                         7.25
    IO8978                    3/15/2012                                   4                         9.25
    IO8978                    1/20/2009                                   5                         10.25
    MY CODE RESULTS SHOULD SEE
    START DATE 01/01/2011  END DATE 08/22/2014
    Part                         TransactionDate                         Qty                     Unit cost
    HE8924                  8/22/2014                                   14                        4.25  
    HE8924                  6/13/2012                                   2                          3.25
    UY325               
      8/22/2014                              
        5                    
       6.32
    IO8978                    8/22/2014                                   6                         8.25
    IO8978                    5/20/2013                                   8                         7.25
    IO8978                    3/15/2012                                   4                         9.25

  • CRViewer XI R2 Select Expert error when using dates

    I am using RDC.  CR XI R2 w/ SP2/3.  When I open any report with dates in the output and then use Select Expert and choose a date from the browse or dropdown list I get an error.
    "Error - the ) is missing"
    -Thanking you in advance.... Brent
    Edited by: Brent Lawrence on Jun 11, 2008 2:15 PM
    Edited by: Brent Lawrence on Jun 11, 2008 2:18 PM

    Hello Brent,
    I'm sorry the RDC viewer and the Select Expert do not meet your expectations.  The RDC was deprecated with the release of Crystal Reports 10.  Once the RDC was deprecated it stopped receiving development focus for issues like this.  The RDC remained available for two more versions (XI / XI R2) but it has now been retired with the release of CR 2008 a few months ago.
    I'm surprised to hear that the Select Expert wasn't showing this issue in CR XI (v11.0), unfortunately I won't be able confirm this.
    If you want to roll back to the viewer for CR XI (v11.0) you have to roll back entirely to work with CR XI (v11.0).  You should not mix versions of DLLs (e.g crviewer.dll v11.0 and craxdrt.dll v11.5).  This may work, but it would not be supported for any issues you might encounter.  You indicated in your post that you moved to CR XI R2 (v11.5) to get past another issue that was resolved in CR XI R2, so rolling back entirely won't be a solution.
    With the retirement of the RDC the recommended upgrade path for Windows application development is to move to the Crystal Reports .NET SDK.  The Crystal Reports .NET SDK is available in CR XI R2 so if you want to explore this SDK as well you can visit the online developer library for additional information.  Here's the link:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm
    Sincerely,
    Dan

  • How to : rownum and order by in select statement

    Say I have a select statement with additional 'order by' clause.
    The result set I want prepended by the rownum column.
    But, and here comes the flaw, I want the rownum for the already ordered result set
    not the unordered.
    An example:
    select firstname, lastname from myTable order by lastname;
    When I add the rownum to the select clause,
    'select rownum, firstname, lastname from myTable order by lastname;'
    I might get something like:
    20 Mike Adams
    13 Nina Bravo
    1 Tom Charlie
    But I want the following result:
    1 Mike Adams
    2 Nina Bravo
    3 Tom Charlie
    I could now
    'Select rownum, lastname, firstname from (select firstname, lastname from myTable order by lastname);
    But I guess there is a better way!?!
    which is the best way to accomplish that?
    Thanks for your advice!

    >
    'Select rownum, lastname, firstname from (select firstname, lastname from myTable order by lastname)
    >
    Well if you ask me there is very little difference between this query and the above query
    select rownum, lastname, firstname from mytable;Because rownum is assigned before the order by. The difference is in your query you are assigning a rownum to an ordered resultset but still there is no guarantee oracle is going to read the data in an ordered fashion. In the second query rownum is assigned to an unordered resultset. Again it is the samething. So if you want to guarantee it then I will go for the following option
    select row_number() over(order by lastname) rn, lastname, firstname from mytable
    order by lastnameAlso check this link.
    http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html
    Regards
    Raj
    Edited by: R.Subramanian on Jan 13, 2009 6:20 AM

  • Select list and date picker on one line  -  is this a bug?

    I'm using: Application Express 3.2.0.00.27
    Is the following a bug? If so, how do I get it reported so it will be fixed in a future release of APEX? If not, how do I do it so it ends up the way I want?
    1. create blank page
    2. create html region
    3. create "select list" item (Begin On New Line - Yes, ...Field - Yes, ColSpan - 1, Row Span - 1)
    4. create date picker item (Begin On New Line - No, ...Field - No, ColSpan - 1, Row Span - 1)
    There will be other items displayed in more columns above what I just had you create above. I want the select list and the date picker to display next to each other on same line, so I placed date picker item on same line in same field as select list item.
    HOWEVER... the date picker ends up displayed under the select list item (kind of), instead of next to it on the same line.
    Here's what I get:
    ...................... [Select List Field] Date Picker Label
    Select List Label
    ...................... [Date Picker Field]
    Here's what I want:
    Select List Label [Select List Field] Date Picker Label [Date Picker Field]
    Thanks,
    Steve
    Edited by: sskelton on Aug 3, 2009 11:01 AM
    Edited by: sskelton on Aug 3, 2009 11:02 AM

    Hi Steve,
    I'm not sure if it's the official way, but you could add a post here: Enhancement Request Thread : Post 3.1 - that's what I've been doing :D
    Andy

  • So I have just had my potentially duff hard drive replaced and uploaded my data from time machine to discover that pages is now speaking to me in a different language. The keyboard has been selected as UK during setup. How do I get back to qwerty?

    So I have just had my potentially duff 1Tb hard drive replaced by apple and uploaded my data from time machine only to discover that pages is now speaking to me in a different language. The keyboard has been selected as UK during setup. Any idea how I can get back to qwerty?

    roxandiv wrote:
    pages is now speaking to me in a different language.
    What exactly are you referring to?   Are the menus or templates for Pages in a different language?  Does something strange appear on the screen when you type?
    Could you perhaps use the Camera icon here to post a screenshot of what you are seeing?
    To make sure you have the right keyboard, go to system preferences/language & text/input sources and make sure that only the box for US or British is checked (and that the box for French or German or anything else is not checked).

  • Select expert and dates

    Post Author: barflyz
    CA Forum: Crystal Reports
    Hi, I am using Crystal 11. I connect to Oracle. My report pulls a date field which displays correctly and can be formatted. However, when I use the select expert and select "equal to", the drop down list does nor display the correct dates stored in this field. Any idea on how to solve this issue? thanks!

    Post Author: SKodidine
    CA Forum: Crystal Reports
    Some sample data might prove useful in understanding what exactly is happening.  Barring that, have you tried clicking on 'Show Formula' in the select expert and then just typing in the date instead of choosing it from the drop down list?

  • Select field and hide field at data source ganaration  for LO extrction

    Hi GURU,S
    Could any one tell me what is differce between select field and hide field at data source ganation in LO at r3 side.what happend if u select field and hide field.
    Regards.
    hari

    Hi Hari,
    If you choose Select fields, you'll be able to filter this IO in Selection tab of infopackage (set IO's value(s) to be loaded).
    In case of hide field you'll not have it in the transfer structure at all.
    Best regards,
    Eugene

  • SELECT-OPTIONS and data collection

    Hi All,
    I have one inputfield (say users) via SELECT-OPTIONS and it goes to an internal table called "userlist" with values USER1, USER2 etc...(Example)
    Now, when I query the database with "userlist" as the input, I'm not able to do so because SELECT-OPTIONS contains an Internal table with values LOW, HIGH etc...
    So my input value goes like this IEQUSER1, IEQUSER2 etc......
    Could anyone tell me what should I do in order to get USER1, USER2 etc.
    Thanks in advance,
    Pradeep

    Hi All,
    Sorry. I'm getting the error: 'Line structure of table USERLIST is incorrect'.
    My coding is as follows:
      tables : usr02.
    data: begin of users,
        users type XUBNAME,
    end of users.
      data : it_usr02 like table of usr02.
      data : l_userlist type xubname,    "This is a data elemnt thats already in the system of type BNAME
             p_userlist like l_userlist.
      select-options: userlist for users.
      loop at userlist into l_userlist.
        select * from usr02 into corresponding fields of table it_usr02 where bname in userlist.
      endloop.
    ENDFUNCTION.
    Could you please help?
    Thanks and Regards, Pradeep

  • Date Picker: Only select Month and Year

    Hallo,
    I try to configure the Date Picker. For the users it should only be possible to select Month and Year. The column should be automaticly completed with the first day of the select month and a static time (00:00:00).
    How can I do this?
    Sincerly

    You can't do that with a standard date picker. What you could do is to use it and after you change the value in it you modify the value using javascript and ajax similar to what I do in this example:
    http://htmldb.oracle.com/pls/otn/f?p=31517:9
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Selection based on previous run date , time and current date a

    HI all,
    I have the selection as follows.
    Previous run date :  .12/14/2005..                     previous run time-14:30:56
    current run date : 12/17/2009.                      current run time: 07:05:31
    Here all are parameters. and  current run date is system date  and   current run time is system time.
    i want to fetch all the deliveries from the above selection including previous run date and time.
    Any inputs..

    Hi
    Append current run data and previous run data into a data range parameter,Current time and previous time into time range parameter and fetch the data based on the range parameters.
    Regards
    Srilaxmi

  • Is it possible to select an area on a graph and to delete data directly from it?

    Hi,as written in the message subject, I'm interesting in the possibility of delete data directly from a graph, using two cursors on the x-axis, or selecting directly an area.
    In fact I don't know how to link the cursor position to the data position in an array, in fact if I'm able to do this, I can use the cursors to select an interval on the x-axis and then with the help of a control on the front panel, delete the data from the array, and obtain a new graph without the selected area.
    Thanks for your kindly attention
    Best regards
    Michele Maria Marotta
    PhD students
    University of Salerno-Italy

    I'm assuming from your question that you have an XY graph built from an array, and I'm also assuming the array is sorted by the X axis.
    Create a property node for the graph (Right-click on the terminal and select Create>>Property node). Now you can either select the Cursor>>Cursor position and Cursor>>Active cursor properties to get the coordinates of the cursor(s), or you can select the Cursor List property to get an array of clusters that holds the data for all the cursors. Assuming you only have two cursors, you can use a for loop and place an Unbundle by name VI in it to get the cursor position. Now that you have the positions for both cursors, go back to the original array and remove the data that's between these values.
    Try to take over the world!

  • HT1688 when you double tap the home button to go back to your other apps are those apps always running and using cellular data even if I am not currently using them?  I thought it froze them and didn't use data other that a select few apps like Facebook,

    when you double tap the home button to go back to your other apps are those apps always running and using cellular data even if I am not currently using them?  I thought it froze them and didn't use data other that a select few apps like Facebook, email, etc.  Also I always select no when I download an app and it wants me to have those push notifications.  Because that would mean that I would have to delete my apps after everytime I just them from that bar and that would be very annoying and just stupid.  Or maybe apps do use data and it's just a big scheme to make everyone go over on their data plans. 

    This should help: http://speirs.org/blog/2012/1/2/misconceptions-about-ios-multitasking.html.

  • Since the latest update I cannot send photos Actual size or large. Medium size is as large as they go. I select Large and Actual, but to no avail. I was always able to do this before the update. I photo and I am up to date on everything. Any ideas?.

    Since the latest update I cannot send photos Actual size or large. Medium size is as large as they go. I select Large and Actual, but to no avail. I was always able to do this before the update. iphoto 9. and I am up to date on everything. Any ideas?.

    Are you also setting the file size in the New Message Window in Mail?

Maybe you are looking for

  • Why is it that when I try to redeem my iTunes gift card it goes to a session timeout?

    Every time I try to redeem my iTunes card it just sends me to a session time out.. Also, even when I try to create another account, it sends me to the same page telling me I have a session time out. I don't know how to fix this.

  • Unbreakable Linux Network

    Sorry if this post is redundant or trivial. We have Oracle 11.2 on Unbreakable 5.4 x_64. My question is this. Is it possible to fetch patches for the DB through the Unbreakable Linux Network channels. Links so I can RTFM are most welcome.

  • Comparing elements inside a vector

    Hello, I am having a hard time understanding how to compare elements inside a vector. I have a vector of six strings and I want to compare the first element at index 0 with all other elements at positions 1-5. After that, compare the element at posit

  • TransferHandler need to override double click action

    Hi everyone...need some advice. I've downloaded code from this demo: http://java.sun.com/docs/books/tutorial/uiswing/misc/example-1dot4/index.html#DragFileDemoonly AFTER downloading and making major changes (to incorporate it into my app), did I real

  • Collection.equals

    The javadocs for collection.equals states "The general contract for the Object.equals method states that equals must be symmetric (in other words, a.equals(b) if and only if b.equals(a)). The contracts for List.equals and Set.equals state that lists