Oracle sqlplus comments
database, oracle, sql, sqlplus
Solution
The fist `insert` statement didn't work only because of the last comment `--c` you've placed after the statement terminator. SQL*Plus doesn't allow any text after a statement terminator (';' semicolon in this case). So this version of your first `insert` statement will be executed successfully:
INSERT INTO abc ( a
,b
,c)
VALUES ( '1' --a
,'2' --b
,'3');
So will this one:
INSERT INTO abc ( a
,b
,c)
VALUES ( '1' --a
,'2' --b
,'3') --c;
Problem
Why does the following insert statement not work when executed like `sqlplus <connect> @file` ``` INSERT INTO abc ( a ,b ,c) VALUES ( '1' --a ,'2' --b ,'3'); --c ``` but it works without the comments i.e ``` INSERT INTO abc ( a ,b ,c) VALUES ( '1' ,'2' ,'3'); ``` Does sqlplus flatten the file i.e execute the whole thing on a single line? which might result in rest of the line getting commented out?