If you want to Fetch limited numbers of rows from a table in oracle you can use Rownum.
Or in other words we can say that
It is used to return specific number of rows in a query, we can use ROWNUM in Oracle and LIMIT in MySql.
ROWNUM Syntax for Oracle:
1) SELECT col_name(s)
2) FROM tablename
3) WHERE rownum<=number ;
Example:
If we have to return only first four employee names then the query will be:
SELECT emp_names
FROM Employee
WHERE rownum<=4;
It will return the first four records(emp_names) from Employee table.
0 Comment(s)