& 符号在 SQLPLUS 的转义

有时候,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

 

你可能感兴趣的:(工作日记)