7

我正在尝试使用脚本将大约 15,000 行数据输入到我的表中,但是当我运行脚本时,我得到一个弹出窗口,要求我输入替换变量。

如何阻止它弹出,以便它允许我输入日期?

以下是我需要输入的一些数据行的一些示例

INSERT INTO description 
 (description, item_weight, pickup_customer, delivery customer, category)
VALUES 
 ('Normal', 4771, 'Carfax & Co', 'Matriotism Plc', 'A');

INSERT INTO description 
 (description, item_weight, pickup_customer, delivery customer, category) 
VALUES 
 ('Normal', 2525, 'Matriotism Plc', 'Carfax & Co', 'A');

INSERT INTO description 
 (description, item_weight, pickup_customer, delivery customer, category) 
VALUES 
 ('Normal', 693, 'Matriotism Plc', 'Sylph Fabrication', 'A');

INSERT INTO description 
 (description, item_weight, pickup_customer, delivery customer, category) 
VALUES 
 ('Fragile', 2976, 'Nosophobia Fabrication', 'Carfax & Co', 'B');

INSERT INTO description 
 (description, item_weight, pickup_customer, delivery customer, category) 
VALUES 
 ('Fragile', 3385, 'Nosophobia Fabrication', 'Carfax & Co','B');
4

2 回答 2

9

和号字符 (&) 告诉 oracle 您要使用替换变量。

您可以通过在所有&符号前面加上转义字符来转义这些插入:

SET ESCAPE '\'

INSERT INTO description 
 (description, item_weight, pickup_customer, delivery customer, category) 
VALUES 
 ('Fragile', 3385, 'Nosophobia Fabrication', 'Carfax \& Co','B');

或完全禁用扫描替换变量:

SET SCAN OFF

INSERT INTO description 
 (description, item_weight, pickup_customer, delivery customer, category) 
VALUES 
 ('Fragile', 3385, 'Nosophobia Fabrication', 'Carfax & Co','B');

有关更多信息,请随时查看: http ://ss64.com/ora/syntax-escape.html

于 2012-11-10T22:34:44.600 回答
3

& 字符被解释为替换变量的开始。您可以通过执行完全关闭替换

set define off;

在运行您的语句之前,或者只是在&符号之后立即结束字符串,如

INSERT INTO description 
  (description, item_weight, pickup_customer, delivery customer, category) 
VALUES 
  ('Normal', 2525, 'Matriotism Plc', 'Carfax &'||' Co', 'A');
于 2012-11-10T22:36:05.047 回答