[SQL] Oracle LIMIT clause

To limit the number of rows returned by a query, in standard SQL you would:

FROM table
WHERE [conditions]
LIMIT number

In Oracle you just add ROWNUM to the WHERE clause like:

FROM table
WHERE [conditions] AND ROWNUM=1

To have the equivalent of SQL "LIMIT 1"

No comments:

Post a Comment

With great power comes great responsibility.

Da grandi poteri derivano grandi responsabilità.