-2
select round(long_w,4) 
  from station  
 where lat_n < 137.2345 
 order by lat_n desc 
 limit 1;

this query give

  • ERROR at line 1: ORA-00933: SQL command not properly ended

fix this error

Nick Krasnov
  • 26,886
  • 6
  • 61
  • 78
  • 1
    ORA-00933 is a general message indicating our SQL statements contain at least one syntax error. The solution is to consult the Oracle SQL Reference. There's plenty of guidance on valid syntax. For instance, [here are examples of row limiting queries](https://docs.oracle.com/database/121/SQLRF/statements_10002.htm#BABEAACC). It's worth bookmarking [the docs site for future reference](https://docs.oracle.com/database/121/index.htm). – APC Sep 26 '19 at 15:37
  • Possible duplicate of [SQL Error: ORA-00933: SQL command not properly ended](https://stackoverflow.com/questions/8940471/sql-error-ora-00933-sql-command-not-properly-ended) – Trenton McKinney Sep 26 '19 at 16:02
  • Possible duplicate of [Keep getting ORA-00933: SQL command not properly ended](https://stackoverflow.com/questions/35798347/keep-getting-ora-00933-sql-command-not-properly-ended) – Farasi78 Sep 26 '19 at 19:29

1 Answers1

1

Oracle does not support limit and you are getting an Oracle error. You can instead use:

select round(long_w, 4)
from station
where lat_n < 137.2345
order by lat_n desc 
fetch first 1 row only;

fetch was introduced in Oracle 12. You can also use the keep syntax:

select max(round(long_w, 4)) keep (dense_rank first order by lat_n desc)
from station
where lat_n < 137.2345;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786