0

This Statement:

SELECT id, units, cost FROM   inventory_list WHERE  cost <= 20;

Gives me:

ORA-00923: FROM keyword not found where expected

While this statement:

SELECT * FROM   items WHERE  ilt_id = 'il010230126' OR ilt_id = 'il010230128';

Gives me:

ORA-00933: SQL command not properly ended

Ken White
  • 123,280
  • 14
  • 225
  • 444

2 Answers2

0

Not sure about this and may be version dependent (below link is for oracle 10g... but you can see on this site

https://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm

That cost is an oracle reserved keyword, so it is not wise to use it as a column name.
If you have no control of the table I think you may be able to surround it in double quotes eg select "COST" to avoid oracle picking it up as a reserved word.

By default Oracle creates fields in uppercase so the field name will need to be in uppercase unless when the table was created it was forced into different case by surrounding it in Quotes.

Shaun Peterson
  • 1,735
  • 1
  • 14
  • 19
  • I tried replacing cost with "cost", but I get ORA-00904: "cost": invalid identifier. Sadly I don't have control of the table. Thank you for your help anyway! – Smooth Yoda Mar 08 '19 at 03:04
  • Check here https://stackoverflow.com/questions/1162381/how-do-i-escape-a-reserved-word-in-oracle, they suggest that you may need to put cost in uppercase inside quotes eg "COST" rather than "cost" – Shaun Peterson Mar 08 '19 at 03:13
  • I was able to fix that statement with "COST". Thank you very much! – Smooth Yoda Mar 08 '19 at 03:36
  • No problems, I have updated the answer to reflect the upper case and added an explanation as to why it is upper case for others who read this. – Shaun Peterson Mar 08 '19 at 03:40
0

Check that you don't have invisible characters in your file and that you're using the right encoding. I sometimes accidentally introduce them because I have a non english keyboard map and accidentally hit the wrong key combination.

Just type again one of your SQL statements and test them.

guapolo
  • 2,443
  • 2
  • 20
  • 19
  • I was able to fix one of my statements by retyping it, but with a couple of others, I didn't have the greatest of luck. Thanks! – Smooth Yoda Mar 08 '19 at 03:51