读书人

sqlplus的诠释BUG

发布时间: 2012-12-24 10:43:14 作者: rapoo

sqlplus的注释BUG

BUG如下:

23:24:13 @> conn oe/oe@cry已连接。23:24:25 OE@cry> /* test */23:24:38 OE@cry> /* test */select count(*) from orders;  COUNT(*)----------       105已用时间:  00: 00: 00.05


直接写注释,或者注释写在前面还是可以的,这里要注意/*后有一个空格(为什么需要这个空格下面会有解释)

如果此时我们输入ed,调用编辑器进行命令编辑的时候,这样写入内容

/*test comment*/select count(*) from orders

或者这样写

/*test comment*/

select count(*) from orders

或者这样

--test comment

select count(*) from orders

那么将会提示错误:ORA-24374: 在读取或执行并读取之前没有完成定义,

实践如下:

23:24:53 OE@cry> ed已写入 file afiedt.buf  1* /*test comment*/select count(*) from orders23:25:15 OE@cry> //*test comment*/select count(*) from orders*第 1 行出现错误:ORA-24374: 在读取或执行并读取之前没有完成定义已用时间:  00: 00: 00.0123:25:18 OE@cry> ed已写入 file afiedt.buf  1  /*test comment*/  2* select count(*) from orders23:28:27 OE@cry> //*test comment*/*第 1 行出现错误:ORA-24374: 在读取或执行并读取之前没有完成定义已用时间:  00: 00: 00.0123:35:03 OE@cry> ed已写入 file afiedt.buf  1  --test commment  2* select count(*) from orders23:35:17 OE@cry> /--test commment*第 1 行出现错误:ORA-24374: 在读取或执行并读取之前没有完成定义

另外一个(解释上面/*后为什么要带空格的情况)

如下:

23:28:29 OE@cry> select count(*) from orders;  COUNT(*)----------       105已用时间:  00: 00: 00.0023:30:34 OE@cry> /*test001*/select 123 from dual;  COUNT(*)----------       105已用时间:  00: 00: 00.01


不同的SQL竟然产生一样的结果(注意这里的/*后面没有空格),如果有空格又正常了

23:31:06 OE@cry> /* test001*/select 123 from dual;       123----------       123已用时间:  00: 00: 00.01



以上应该算sqlplus注释的一个小BUG吧。

读书人网 >SQL Server

热点推荐