I am trying to create a SQL statement that brings back the first 100 records in a table. You can do this using TOP in SQL Server but it doesn't seem to work on Oracle. Does anyone know what I need to use?
Originally posted by nishant select * from table_name where rownum <=100;
Wait a second now! How do we define first and last record of an Oracle table? If you mean last record inserted, there is no way to get it unless you programatically keep a field storing this information.
Oracle Certified Master
Oracle Certified Professional 6i,8i,9i,10g,11g
You are right we cannot get the last record inserted till we keep a column to store the value.I think the original question was just to retrive the top 100 records in the table without any mention of whether it was last inserted or first.Do correct me if i am wrong.