0

How to get most recently inserted record in oracle, I have inserted Aditya as last record in email column in table(Table has only one column EMAIL).

Expected output : Aditya

enter image description here

Thank,

Vijay
  • 15
  • 2
  • 4
    First/Last/Oldest/Newest only have meaning if there is a value in the table you can ORDER BY to enforce the concept - such as an identity value. – Alex K. Jun 26 '18 at 12:05
  • well you can use `ORA_ROWSCN` however if the table is created as rowdependecy – Moudiz Jun 26 '18 at 13:45
  • @Moudiz tried that one(ORA_ROWSCN), but it will take same value for all inserted records in ora_rowscn column. I tried the below query select ora_rowscn,email,scn_to_timestamp(ora_rowscn) from Table_name order by scn_to_timestamp(ora_rowscn) desc – Vijay Jun 26 '18 at 14:46
  • @Vijay yes it will not for old records only for the new one. – Moudiz Jun 26 '18 at 15:03
  • @Moudiz yes but if we insert 5 records then it will have same value, we cant make out which one is the latest one or last inserted record – Vijay Jun 28 '18 at 07:11

0 Answers0