Home >Database >Mysql Tutorial >How to Fix ORA-00936: Missing Expression in Oracle's INSERT SELECT Statement?
Error: ORA-00936 Missing Expression in INSERT SELECT Statement
While attempting to insert the results of a subquery into a table using the INSERT SELECT statement in Oracle 11g, users may encounter the ORA-00936 error, indicating a missing expression.
The typical syntax for INSERT SELECT is:
INSERT INTO table_name (column_list) VALUES (select_statement)
However, in this case, the issue stems from the inclusion of the VALUES keyword. The correct syntax for an INSERT SELECT statement does not require the VALUES keyword.
To resolve the issue, simply omit the VALUES part from the statement:
INSERT INTO table1 (col1, col2) SELECT t1.col1, t2.col2 FROM oldtable1 t1, oldtable2 t2
This revised statement will correctly insert the results of the subquery into table1.
The above is the detailed content of How to Fix ORA-00936: Missing Expression in Oracle's INSERT SELECT Statement?. For more information, please follow other related articles on the PHP Chinese website!