SQL 如何使用一条插入语句将多行插入到 oracle 数据库中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14441240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 13:13:37 来源:igfitidea点击:
How can I insert multiple row into oracle database using one insert statement?
提问by Moataz Aahmed Mohammed
Possible Duplicate:
Best way to do multi-row insert in Oracle?
可能的重复:
在 Oracle 中进行多行插入的最佳方法?
I have this insert statement
我有这个插入语句
INSERT INTO mytable VALUES
('val1', 'val2'),
('aa', 'cc'),
('ww', 'dd');
and I got this error ORA-00933: SQL command not properly ended
我收到这个错误 ORA-00933: SQL 命令没有正确结束
回答by John Woo
you are using oracle, try this
你正在使用 oracle,试试这个
INSERT ALL
INTO mytable ("id", "name")
VALUES ('val1', 'val2')
INTO mytable ("id", "name")
VALUES ('aa', 'cc')
INTO mytable ("id", "name")
VALUES ('ww', 'dd')
SELECT * FROM dual ;
or simple
或简单
INSERT INTO mytable ("id", "name") VALUES ('val1', 'val2');
INSERT INTO mytable ("id", "name") VALUES ('aa', 'cc');
INSERT INTO mytable ("id", "name") VALUES ('ww', 'dd');