gpt4 book ai didi

SQL 命令未正确结束 - INSERT MULTIPLE ROWS - SQL

转载 作者:行者123 更新时间:2023-12-04 07:54:57 30 4
gpt4 key购买 nike

我不知道为什么当我尝试添加多行时 SQL Developer 返回“SQL 命令未正确结束”。当我尝试插入一行时,一切正常。有人可以帮我吗?谢谢。

INSERT INTO TEAMS (TEAM_ID, NAME, POSITION, PLAYED, WIN, LOSE, DRAW, GF, GA, GD, POINTS)
VALUES
('MUN','MANCHESTER UNITED', 2, 29, 16, 9, 4, 56, 32, 24, 57),
('LEI','LEICESTER CITY', 3, 29, 17, 5, 7, 53, 32, 21, 56),
('CHE','CHELSEA', 4, 29, 14, 9, 6, 44, 25, 19, 51); ```

最佳答案

Oracle 需要单独的插入语句。 VALUES 只能用于单行。或者,您可以使用 INSERT 。 . .选择:

INSERT INTO TEAMS (TEAM_ID, NAME, POSITION, PLAYED, WIN, LOSE, DRAW, GF, GA, GD, POINTS)
SELECT 'MUN','MANCHESTER UNITED', 2, 29, 16, 9, 4, 56, 32, 24, 57 FROM DUAL UNION ALL
SELECT 'LEI','LEICESTER CITY', 3, 29, 17, 5, 7, 53, 32, 21, 56 FROM DUAL UNION ALL
SELECT 'CHE','CHELSEA', 4, 29, 14, 9, 6, 44, 25, 19, 51 FROM DUAL;

关于SQL 命令未正确结束 - INSERT MULTIPLE ROWS - SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66752348/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com