Clomez
Clomez

Reputation: 1512

LIMIT breaking @Query

so...

following loooong query

@Query(value = "SELECT A, B ... FROM ADMIN.SUPER_SEARCH WHERE A = :param OR B = :param ORDER BY A desc", nativeQuery = true )

will work just fine (i replaced few fields with ... it is a looong query)

but as soon as i add LIMIT 5 to end of query, it will throw

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

so this is the error query

@Query(value = "SELECT A, B ... FROM ADMIN.SUPER_SEARCH WHERE A = :param OR B = :param ORDER BY A desc LIMIT 5", nativeQuery = true )

WHY?

I would really need the limit here, since table is about 300k rows long..

Upvotes: 0

Views: 66

Answers (1)

Diego Victor de Jesus
Diego Victor de Jesus

Reputation: 3003

Try:

@Query(value = "SELECT A, B ... FROM ADMIN.SUPER_SEARCH WHERE A = :param OR B = :param AND rownum <= 5 ORDER BY A desc", nativeQuery = true )

Upvotes: 2

Related Questions