问题
INSERT INTO Countries (Country, Capital, Cities)
VALUES ('Philippines','Manila',122),
('USA','Washington',19495),
('Brazil','Brasilia',1642),
('Latvia','Riga',9),
('Egypt','Cairo',124)
;
I've tried removing the (Country, Capital, Cities)
, sticking it back on, putting them all in the same line, putting bigger indents, spacing them out. nothing. It keeps throwing me this error: ORA-00933: SQL command not properly ended.
. What's wrong with my code?
回答1:
Oracle doesn't support inserting multiple rows using a single values
. I find that the simplest method is insert . . . select
:
INSERT INTO Countries (Country, Capital, Cities)
SELECT 'Philippines', 'Manila', 122 FROM DUAL UNION ALL
SELECT 'USA', 'Washington', 19495 FROM DUAL UNION ALL
SELECT 'Brazil', 'Brasilia', 1642 FROM DUAL UNION ALL
SELECT 'Latvia', 'Riga', 9 FROM DUAL UNION ALL
SELECT 'Egypt', 'Cairo', 124 FROM DUAL;
来源:https://stackoverflow.com/questions/64644823/livesql-keeps-showing-me-this-ora-00933-sql-command-not-properly-ended