ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [20120606]sql中的注解问题.txt

[20120606]sql中的注解问题.txt

原创 Linux操作系统 作者:lfree 时间:2012-06-06 10:49:45 0 删除 编辑
SQL> select * from v$version ;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

create table t1 (id number);

2.建立如下脚本,注意注解*后面的方式,1个*后无空格一个后面有空格.

$cat aa.sql

insert into t1 values (1);
/*this is a test*/
/* this is a test*/
commit ;
select * from t1;
/*+this is a test*/


SQL> @aa.sql

1 row created.


1 row created.


Commit complete.

        ID
----------
         1
         1

--可以发现插入两个记录.


3.手工执行如下:

SQL> insert into t1 values(101);

1 row created.

SQL> /*+aaa*/
SQL> /*aaa*/

1 row created.

SQL> commit ;

Commit complete.

SQL> select * from t1;
        ID
----------
         1
         1
       101
       101

SQL> /* ccc*/
SQL> /*+ ccc*/
SQL> /*ccc*/
        ID
----------
         1
         1
       101
       101

--说明写注解要注意!不知道这个算oracle的bug吗?好像其他版本也有!



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-732031/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969544