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 orders
23:25:15 OE@cry> /
/*test comment*/select count(*) from orders
*
第 1 行出现错误:
ORA-24374: 在读取或执行并读取之前没有完成定义


已用时间:  00: 00: 00.01
23:25:18 OE@cry> ed
已写入 file afiedt.buf

  1  /*test comment*/
  2* select count(*) from orders
23:28:27 OE@cry> /
/*test comment*/
*
第 1 行出现错误:
ORA-24374: 在读取或执行并读取之前没有完成定义


已用时间:  00: 00: 00.01

23:35:03 OE@cry> ed
已写入 file afiedt.buf

  1  --test commment
  2* select count(*) from orders
23:35:17 OE@cry> /
--test commment
*
第 1 行出现错误:
ORA-24374: 在读取或执行并读取之前没有完成定义

 

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

如下:

23:28:29 OE@cry> select count(*) from orders;

  COUNT(*)
----------
       105

已用时间:  00: 00: 00.00
23: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吧。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值