ORA-00933错误求助:INSERT语句未正确终止(Oracle APEX 11G)
Hey there, let's sort out why you're hitting that ORA-00933 error when trying to do a bulk INSERT in Oracle 11g. I'll break down the issue and walk you through the fixes step by step.
The Root Cause
First off, the syntax you're using—listing multiple value sets in a single VALUES clause like VALUES (...), (...), (...)—isn't supported in Oracle 11g. That bulk insert style was introduced in Oracle 12c and later versions, so your 11g database doesn't recognize it, hence the "SQL command not properly ended" error.
Also, a quick heads-up: you're using double quotes (") around string values (e.g., "Chris"). In Oracle, double quotes are reserved for quoting database object names (like tables or columns), not string literals. You need to use single quotes (') instead—otherwise, Oracle will try to interpret those as column names, which will cause extra errors.
Solutions for Oracle 11g
1. Use the INSERT ALL Statement
This is the standard way to do bulk inserts in 11g. Here's how to rewrite your query correctly:
INSERT ALL INTO Owner(O_ID, O_First, O_Last, O_Line, O_City, O_State, O_Zip, O_Phone, O_Email) VALUES (1102, 'Chris', 'Leaves', '141-17 Union Turnpike Apt 3P','Flushing', 'NY', '11367', '7182105108','chris2@gmail.com') INTO Owner(O_ID, O_First, O_Last, O_Line, O_City, O_State, O_Zip, O_Phone, O_Email) VALUES (1433, 'Steve', 'Jobs', '88-12 Main Street','Flushing', 'NY', '11367', '7189998476', 'steve12@gmail.com') INTO Owner(O_ID, O_First, O_Last, O_Line, O_City, O_State, O_Zip, O_Phone, O_Email) VALUES (2443, 'Chris', 'Melvin', '151-17 Jewel Avenue','Flushing', 'NY', '11367', '7185551234', 'chris.m@example.com') SELECT * FROM DUAL;
Don't forget the SELECT * FROM DUAL at the end—it's required to make the INSERT ALL syntax work.
2. Use Separate INSERT Statements
If you prefer a simpler (though less efficient for large datasets) approach, you can run individual INSERT commands:
Insert into Owner(O_ID, O_First, O_Last, O_Line, O_City, O_State, O_Zip, O_Phone, O_Email) VALUES (1102, 'Chris', 'Leaves', '141-17 Union Turnpike Apt 3P','Flushing', 'NY', '11367', '7182105108','chris2@gmail.com'); Insert into Owner(O_ID, O_First, O_Last, O_Line, O_City, O_State, O_Zip, O_Phone, O_Email) VALUES (1433, 'Steve', 'Jobs', '88-12 Main Street','Flushing', 'NY', '11367', '7189998476', 'steve12@gmail.com'); Insert into Owner(O_ID, O_First, O_Last, O_Line, O_City, O_State, O_Zip, O_Phone, O_Email) VALUES (2443, 'Chris', 'Melvin', '151-17 Jewel Avenue','Flushing', 'NY', '11367', '7185551234', 'chris.m@example.com');
Just make sure each statement ends with a semicolon.
Quick Reminder
- Stick to single quotes for string literals in Oracle—double quotes are only for case-sensitive object names.
- If you ever upgrade to Oracle 12c or later, the multi-value
VALUESsyntax you originally used will work, but for now, these 11g-compatible methods will get the job done.
内容的提问来源于stack exchange,提问作者Denis Jones

