我正在LibreOfficeBase中使用odb文件,并尝试一次插入一堆行。
我正在使用以下代码:
INSERT INTO RELATIONSHIP_BTWN_PEOPLE ("RelationID", "SubjectPersonID", "RelationType", "ObjectPersonID")
VALUES (11501, 9163, 'Parent Of',9165),
VALUES (11502, 9164, 'Parent Of',9165),
VALUES (11503, 9165, 'Child Of',9163),
VALUES (11504, 9165, 'Child Of',9164);
我收到以下错误:
意外的标记,在语句[,]
中
但是当我删除逗号时,会出现错误
意外的VALUES语句
我知道代码正在工作,因为它确实在[,]
之前输入了第一行对于这个问题,我看到的两个答案是:
答案 0 :(得分:1)
您必须省略第二名,并且超越values
。试试:
INSERT INTO RELATIONSHIP_BTWN_PEOPLE ("RelationID","SubjectPersonID","RelationType", "ObjectPersonID")
VALUES (11501, 9163, 'Parent Of',9165),
(11502, 9164, 'Parent Of',9165),
(11503, 9165, 'Child Of',9163),
(11504, 9165, 'Child Of',9164);
答案 1 :(得分:0)
您需要4条插入语句:
INSERT INTO RELATIONSHIP_BTWN_PEOPLE ("RelationID","SubjectPersonID","RelationType", "ObjectPersonID") VALUES (11501, 9163, 'Parent Of',9165);
INSERT INTO RELATIONSHIP_BTWN_PEOPLE ("RelationID","SubjectPersonID","RelationType", "ObjectPersonID") VALUES (11502, 9164, 'Parent Of',9165);
INSERT INTO RELATIONSHIP_BTWN_PEOPLE ("RelationID","SubjectPersonID","RelationType", "ObjectPersonID") VALUES (11503, 9165, 'Child Of',9163);
INSERT INTO RELATIONSHIP_BTWN_PEOPLE ("RelationID","SubjectPersonID","RelationType", "ObjectPersonID") VALUES (11504, 9165, 'Child Of',9164);