0

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

2
  • oracle use other methods to fullfill top Commented Sep 8, 2016 at 8:17
  • select TOPIC,SEQ,INFO FROM HELP where rownum < 150 ; this should work..Limit doesnot work with select in oracle Commented Sep 8, 2016 at 8:19

3 Answers 3

1

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
Sign up to request clarification or add additional context in comments.

Comments

0

using ROWNUM:

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

3 Comments

getSampleData Mysql select TOPIC,SEQ,INFO FROM HELP LIMIT 10; Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
do not give semicolon and try
select TOPIC,SEQ,INFO FROM HELP WHERE ROWNUM <=150 Works fine
0

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;

2 Comments

This is for SQL server.
select TOPIC,SEQ,INFO FROM HELP WHERE ROWNUM <=150 Works fine. THx a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.