set define off ——插入特殊字符,如&

在插入数据遇到&时,oracle会认为是个变量,要求输入值。
原因在于oracle将&定义为自定义变量。
SQL> show all   
appinfo is OFF and set to "SQL*Plus"
arraysize 15
autocommit OFF
autoprint OFF
autorecovery OFF
autotrace OFF
blockterminator "." (hex 2e)
btitle OFF and is the first few characters of the next SELECT statement
cmdsep OFF
colsep " "
compatibility version NATIVE
concat "." (hex 2e)
copycommit 0
COPYTYPECHECK is ON
define "&" (hex 26)
describe DEPTH 1 LINENUM OFF INDENT ON
echo OFF
editfile "afiedt.buf"
embedded OFF
escape OFF
escchar OFF
......

此时只要set define off,即可插入包含&的值。

Using the SET DEFINE OFF Command

To avoid the prompt in the preceding example by using the SET DEFINE OFF command, change the entry to the following:

SET DEFINE OFF

CREATE TABLE "Employees & Managers" (
    Employees varchar(16), 
    Managers varchar(16));


SET DEFINE OFF

SET DEFINE OFF disables the parsing of commands to replace substitution variables with their values.


注意:如果是在TOAD中执行,建议在每一个要导入的脚本第一行加上前面那句关闭define的话,否则当你导入第二个含有特殊字符的脚本的时候,又会出错。
        如果是在SQL*PLUS中执行,则只需要设置一次define OFF,后面就可以连续导入了。直到你重新设置define ON为止。







  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值