oldwain随便写 http://oldwain.itpub.net/ <a href="http://oldwain.itpub.net">oldwain随便写</a>

也许你还不知道 - sqlplus的小秘密(2)

上一篇 / 下一篇  2005-09-06 00:00:00 / 个人分类:Oracle

Sql*plus中, 不允许sql语句中间有空行, 这在从其它地方拷贝脚本到sql*plus中执行时很麻烦. 比如下面的脚本:

select deptno, empno, ename
from emp

where empno = '7788';

如果拷贝到sql*plus中执行, 就会出现错误:


f z zioo^$o0
scott@O9I.US.ORACLE.COM> select deptno, empno, ename
  2  from emp
  3
scott@O9I.US.ORACLE.COM> where empno = '7788';
SP2-0734: unknown command beginning "where empn..." - rest of line ignored.
scott@O9I.US.ORACLE.COM>

原因是sqlplus遇到空行就认为是语句结束了.ITPUB个人空间 pS0bpt sXH
其实要改变这种现象, 只要使用SQLBLANKLINES参数就可以了.

scott@O9I.US.ORACLE.COM> SET SQLBLANKLINES ON
scott@O9I.US.ORACLE.COM>
scott@O9I.US.ORACLE.COM> select deptno, empno, ename
  2  from emp
  3
  4  where empno = '7788';

    DEPTNO      EMPNO ENAME
---------- ---------- ----------
        20       7788 SCOTT

scott@O9I.US.ORACLE.COM>

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-11-23  
      1
2345678
9101112131415
16171819202122
23242526272829
30      

数据统计

  • 访问量: 2741
  • 日志数: 1042
  • 建立时间: 2007-11-28
  • 更新时间: 2008-02-22

RSS订阅

Open Toolbar