0

I need the solution for the following query in oracle

select * from option_list order by option_id LIMIT 4 OFFSET 1

facing following errror while execution

odbc_exec(): SQL error: [Oracle][ODBC][Ora]ORA-00933: SQL command not properly ended

kindly help me to get solution for offset and limit in oracle query execution with php

Note : in postgres query is working fine but problem is with oracle

Barbaros Özhan
  • 39,060
  • 9
  • 21
  • 45
Shivukumar
  • 11
  • 3

1 Answers1

0

Here is your solution you have to make query structure like this

select * 
  from ( select /*+ FIRST_ROWS(n) */ 
  a.*, ROWNUM rnum 
      from ( your_query_goes_here, 
      with order by ) a 
      where ROWNUM <= 
      :MAX_ROW_TO_FETCH ) 
where rnum  >= :MIN_ROW_TO_FETCH;

for more details please go to here

Ritul Lakhtariya
  • 368
  • 1
  • 15