DEF[INE] {c|OFF|ON}
设置置换变量的前缀字符。
[OFF]:不扫描置换变量,不替换置换变量的值。此设置会覆盖系统变量SCAN的设置。
[ON]:扫描并替换置换变量的值。设为ON后会自动把置换变量前缀改为“&”。
[c]:设置置换变量的前缀字符为指定字符。
代码
SQL> set define #
SQL> define aa=scott.dept
SQL> select * from #aa; ---将把此处的置换变量#aa替换为scott.dept
原值 1: select * from #aa
新值 1: select * from scott.dept
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> set define off ---禁止扫描替换变量
SQL> select * from #aa; ---此处的#aa不再作为置换变量,因此将会出错
select * from #aa
*
ERROR 位于第 1 行:
ORA-00911: 无效字符