-1

我正在尝试将数据插入表中:

INSERT INTO CIVILSTATUS
  (CivilStatusID, CivilStatusDesc)
VALUES (1, 'Single'),
       (2, 'Married'),
       (3, 'Separate'),
       (4, 'Widower');

但我收到了这个错误:

Error SQL: ORA-00933: comand SQL not properly ended
00933. 00000 -  "SQL command not properly ended"

我做对了还是我的语法有错误?

4

3 回答 3

1

我会重写这个如下

INSERT ALL 
INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (1, 'Single')
INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (2, 'Married')
INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (3, 'Separate')
INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (4, 'Widower')
SELECT * FROM CIVILSTATUS
于 2013-10-14T21:27:12.373 回答
0

对于多行,您需要使用选择,如下所示:

insert into civilstatus
(CivilStatusID, CivilStatusDesc)
select 2, 'Married' from dual
union all select 3, 'Separate' from dual;
于 2013-10-14T21:30:02.253 回答
0

使用此语法:

INSERT ALL
   INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (1, 'Single')
   INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (2, 'Married')
   INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (3, 'Separate')
   INTO CIVILSTATUS (CivilStatusID, CivilStatusDesc) VALUES (4, 'Widower')
   .
   .
   .
SELECT 1 FROM DUAL;
于 2013-10-14T21:26:54.747 回答