我正在看Oracle中的脚本,我看到我不认识的东西
REM INSERTING into database1."Users" SET DEFINE OFF; Insert into database1."Users" ("id","right") values ('1','R');
我正在寻找有关“set define off”的文档,并且以字面上写“禁用解析命令以替换替换变量与其值”
我真的不明白他们想说什么
有人可以帮我吗
感谢提前,恩里克
默认情况下,sql Plus处理’&’作为开始替换字符串的特殊字符。这可能会导致运行脚本的问题,而这些脚本恰好包含’&’由于其他原因:
sql> insert into customers (customer_name) values ('Marks & Spencers Ltd'); Enter value for spencers: old 1: insert into customers (customer_name) values ('Marks & Spencers Ltd') new 1: insert into customers (customer_name) values ('Marks Ltd') 1 row created. sql> select customer_name from customers; CUSTOMER_NAME ------------------------------ Marks Ltd
如果您知道您的脚本包含(或可能包含)包含“&”的数据字符,并且您不想像上述那样执行替换行为,然后在运行脚本时使用set define off关闭该行为:
sql> set define off sql> insert into customers (customer_name) values ('Marks & Spencers Ltd'); 1 row created. sql> select customer_name from customers; CUSTOMER_NAME ------------------------------ Marks & Spencers Ltd
您可能希望在脚本末尾添加set define on,以恢复默认行为。