DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Most Current Row

  1. #1
    Join Date
    Jul 2001
    Posts
    334

    Most Current Row

    Hi All,

    How to query the most recent/current row? there is no date column so we can not check by current date.


    Thanks in advance.

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    If you mean the last one inserted, then unless your insert code marks the rows sequentialy or timestamps them, then you're out of luck. You might investigate using Log Miner to find the last insert, though it'd not be completely straightforward
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Jul 2001
    Posts
    334
    Hi,
    Let me give you more clear picture of what I need. Consider emp table.

    deptno name
    10 aaa
    10 bcx
    10 abv
    20 jjj
    20 kjh

    I need to know what is the latest record being entered into deptno 10.


    Thanks.

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    In your example data set which is the most recent record, and why?
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  5. #5
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Originally posted by aph
    Hi,
    Let me give you more clear picture of what I need. Consider emp table.

    deptno name
    10 aaa
    10 bcx
    10 abv
    20 jjj
    20 kjh

    I need to know what is the latest record being entered into deptno 10.


    Thanks.
    You can always guess. Why don't you have a time stamp on the table? You should have when it was created, who created it, when it was last updated and who updated it.

  6. #6
    Join Date
    Jul 2001
    Posts
    334
    Hi,

    I need to enter this data through Form (tabular form), now let's say I have entered 5 rows and at the end click save.
    deptno name
    10 aaa
    10 awe
    10 klf
    10 sdf
    10 shg(last row)
    (save it)
    What could be the time diff. All 5 rows should be the same time.

    Now my requirement is each time e.g query the deptno 10 it should display last entered row first.

    next time query, I should get
    deptno name
    10 shg (display as 1st)
    10 aaa
    10 awe
    10 klf
    10 sdf

    Thanks

  7. #7
    Join Date
    Dec 2000
    Posts
    126
    you can add sequence_number column to the table.
    This column is updated every time record is inserted into table.

  8. #8
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Originally posted by culonbu
    you can add sequence_number column to the table.
    This column is updated every time record is inserted into table.
    I suspect that this is not reliable in a multi-instance environment (OPS or RAC) if your sequences are cached. Anyone like to put me right on that?

  9. #9
    Join Date
    Jan 2001
    Posts
    2,828
    Originally posted by aph
    Hi,
    Let me give you more clear picture of what I need. Consider emp table.

    deptno name
    10 aaa
    10 bcx
    10 abv
    20 jjj
    20 kjh

    I need to know what is the latest record being entered into deptno 10.


    Thanks.
    Hi

    Create a history table and have the history table populated with triggers .The history table should aslo contain a timestamp.With that you are good to go.

    regards
    Hrishy

  10. #10
    Join Date
    Dec 2000
    Posts
    126

    Originally posted by Dapi
    I suspect that this is not reliable in a multi-instance environment (OPS or RAC) if your sequences are cached.
    Anyone like to put me right on that?
    RAC) if your sequences are cached.
    Anyone like to put me right on that?

    quote:
    --------------------------------------------------------------------------------
    Originally posted by culonbu
    you can add sequence_number column to the table.
    This column is updated every time record is inserted into table.
    --------------------------------------------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width