& 符号在 SQLPLUS 的转义

来源:互联网 发布:哪里有淘宝培训班 编辑:程序博客网 时间:2024/05/22 10:37

有时候,SQL语句中包含了 & 符号,&是数据库中存储的值,而非要求我们输入某个值, 如果你在 SQLPLUS中运行该SQL,

可以用 set define off 命令 忽略 &

举个例子:

 

SQL> select 'This is &Robinson' from dual;
Enter value for robinson: *
old   1: select 'This is &Robinson' from dual
new   1: select 'This is *' from dual

'THISIS*'
---------------------------
This is *

SQL> set define off
SQL> select 'This is &Robinson' from dual;

'THISIS&ROBINSON'
---------------------------------------------------
This is &Robinson

 

原创粉丝点击