我有一个查询,我试图将数据插入到我使用SQL命令创建的数据库中,例如
CREATE TABLE CUSTOMER
(
REFERENCE NUMBER(5) PRIMARY KEY,
COMPANY VARCHAR2(20),
ADDRESS VARCHAR2(30),
TELEPHONE NUMBER(12),
CONTACT VARCHAR2(20)
);
我正在尝试使用多行插入数据
我很确定这种语法是正确的,但它会返回错误“ORA-00911:无效字符”
这就是我要插入的内容:
insert into customer values (130,'Affright Retail','18 Redingote Dell Tonbridge TN46 7JF',01208830667,'John Elrick');
insert into customer values (149,'Askew Inc.','37 Unmediated Parkway Walsall UB20 9WA',01299818072,'Sean Walker');
答案 0 :(得分:1)
您使用什么应用程序来运行这些命令?
如果您尝试从自定义应用程序运行多个语句,则可能需要创建单个PL / SQL块
BEGIN
INSERT INTO customer( customer_id,
customer_name,
customer_address,
customer_code,
customer_contact )
VALUES( 130,
'Affright Retail',
'18 Redingote Dell Tonbridge TN46 7JF',
01208830667,
'John Elrick');
INSERT INTO customer( customer_id,
customer_name,
customer_address,
customer_code,
customer_contact )
VALUES( 149,
'Askew Inc.',
'37 Unmediated Parkway Walsall UB20 9WA',
01299818072,
'Sean Walker' );
END;
如果您在SQL * Plus或某些PL / SQL IDE中运行它们,则可能需要使用特定于工具的分隔符(在SQL * Plus中,在单独的行上为/
)。
答案 1 :(得分:1)
单独尝试每个插入以确保两者都有效。如果他们似乎都单独工作,那么尝试在每次插入后放一个斜杠(“/”),这应该照顾它。见下文。
insert into customer values (130,'Affright Retail','18 Redingote Dell Tonbridge TN46 7JF',01208830667,'John Elrick');
/
insert into customer values (149,'Askew Inc.','37 Unmediated Parkway Walsall UB20 9WA',01299818072,'Sean Walker');
/