I want to get the last row, which I inserted into a table in an Oracle 11g Express database.
How can I do this?
I want to get the last row, which I inserted into a table in
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no such thing as the “last” row in a table, as an Oracle table has no concept of order.
However, assuming that you wanted to find the last inserted primary key and that this primary key is an incrementing number, you could do something like this:
If you have the date that each row was created this would become, if the column is named
created:Alternatively, you can use an aggregate query, for example:
Here’s a little SQL Fiddle to demonstrate.