Everyone is interested in the result of an SQL statement, here we are going to see what is happening in the background when a SQL is executed.
During the parsing phase, Oracle will break down the submitted SQL statement into its component parts, determine what type of statement it is (Query, DML, or DDL), and perform a series of checks on it. The first two steps in parsing are
1. Syntax Check
Oracle checks that the SQL statement is valid. it checks for the rightness of the keywords and position. For example, whether SELECT statement has FROM in right position?
2. Semantic Check
Semantic Check checks if the statement is valid in the context of the objects in the database like Do the tables and columns referenced in the SQL statement actually exist in the database? Does the user executing the statement have access to the objects and are the proper privileges in place? Are there ambiguities in the statement? For example, consider a SQL Select statement “Select * from EMP123″, syntactically the statement is right, but if there is no table called EMP123, then it is semantically wrong.
For example, the following SQL statement fails with a syntax error:
SQL> select from where 4; select from where 4 * ERROR at line 1: ORA-00936: missing expression
Here is an example of a SQL statement that fails with a semantic error:
SQL> select * from table_doesnt_exist; select * from table_doesnt_exist * ERROR at line 1: ORA-00942: table or view does not exist