Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2012
    Posts
    5

    Unanswered: How to read top last inserted row?

    Im looking for solution to read the last inserted row in the table using oracle 10g and aslo looking better solution to read the 1000 records for every second

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    If you are inserting some kind of an ID (a sequence) or timestamp, then you can select record whose ID or timestamp is equal to maximum ID or timestamp. Otherwise, you're pretty much out of luck.

    As of your next question: I don't understand it at all. "Better solution" than what? What solution do you have now? What does "read 100 records for every second" mean? Read from where? What does "every second" represent? Do you want to select 1000 records every second, or do you have records stored into a table, they have some timestamp column, and you want to select 1000 of them that share the same second in that timestamp column, or what?

  3. #3
    Join Date
    Nov 2012
    Posts
    5
    1.
    My table structure look like this

    Column1 - Primary key - int - notnull
    Column2 - nvarchar(1000)- notnull
    Column3 - nvarchar(50)- null
    Column4 - int - null
    Column5 - Foreign Key -int -not null
    Column6 -DateTime- null
    Column7 - int - null

    and i need to get the latest/last inserted row from above table.

    2. I want to select >1000 records every second from oracle DB using c#

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    If a primary key column gets its value from a sequence then
    Code:
    sselect *
    from your_table
    where column1 = (select max(column1)
                     from your_table
                    );
    Column6 might be a candidate, but it allows NULL values so you'd rather not rely on it.

    Your second question should be posted in C# forum, not here. You might get the answer, though, but not from me. Not because I don't want to, but because I don't know HOW to do that.

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    rows in a table are like balls in a basket.
    Which ball in a basket is the last ball?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  6. #6
    Join Date
    Nov 2012
    Posts
    5
    thanks for your reply

Posting Permissions

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