0

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..

Clomez
  • 1,410
  • 3
  • 21
  • 41

1 Answers1

2

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 )
Diego Victor de Jesus
  • 2,575
  • 2
  • 19
  • 30