Exploring Common Logical Mistakes

So far today, we have covered faults in SQL statements that generate actual error messages. Most of these errors are obvious and their resolutions leave little to the imagination. The next few mistakes are more (or less) logical, and they may cause problems later—if not immediately.

Using Reserved Words in Your SQL Statement

In the following example, the query processor is not expecting the word DATE because it is a reserved word:

SQL> select sysdate DATE
  2  from dual;

select sysdate DATE
               *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

There is no comma after the pseudocolumn SYSDATE; therefore, the next element expected is the FROM clause.

A reserved word in an implementation is a word ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.