Oracle sqlplus 注释 [英] Oracle sqlplus comments
问题描述
为什么下面的insert语句像sqlplus <connect>那样执行时不起作用@file
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');
sqlplus 是否会压平文件,即在一行中执行整个内容?这可能会导致该行的其余部分被注释掉?
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?
推荐答案
第一个 insert
声明 不起作用 只是因为最后一条评论 --c
放在语句终止符之后.SQL*Plus 不允许在语句终止符(在本例中为;"分号)后有任何文本.所以你的第一个 insert
语句的这个版本将被成功执行:
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');
这个也是:
INSERT INTO abc ( a
,b
,c)
VALUES ( '1' --a
,'2' --b
,'3') --c;
这篇关于Oracle sqlplus 注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!