user2582322
user2582322

Reputation: 33

Oracle Select Query with row limit

This is my Oracle query

select TOPIC,SEQ,INFO FROM HELP TOP 150;

and below is the exception

java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

Upvotes: 0

Views: 836

Answers (3)

Abhijeet
Abhijeet

Reputation: 4309

If you want to use TOP correct query would be : For SQL Server / MS Access

select TOP 150 TOPIC,SEQ,INFO FROM HELP;

Other options : For Oracle and MySql

SELECT TOPIC,SEQ,INFO FROM HELP WHERE ROWNUM <=150;

Upvotes: 0

Sunil B N
Sunil B N

Reputation: 4225

Oracle:

select TOPIC,SEQ,INFO FROM HELP WHERE ROWNUM <= 150

MySQL:

select TOPIC,SEQ,INFO FROM HELP LIMIT 150

SQL Server / MS Access Syntax

select TOP 150 TOPIC,SEQ,INFO FROM HELP

Upvotes: 1

apomene
apomene

Reputation: 14389

using ROWNUM:

 select TOPIC,SEQ,INFO FROM HELP WHERE ROWNUM <=150

Upvotes: 0

Related Questions