cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Script error - Inserting multiple rows in one SQL statement.

Former Member
0 Likes
1,282

Hi,

Tried using INSERT ALL INTO command inside Script. But getting below error.

Oracle <> error message for operation <OCIStmExecute>: <ORA-00928: missing SELECT keyword>.

Same query with single insert statement runs fine without any issues.

Oracle eg:

INSERT ALL

    INTO item (title) VALUES ('title5')

    INTO item (title) VALUES ('title6')

    INTO item (title) VALUES ('title7')

SELECT * FROM dual;

Appreciate your suggestions.

Thx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Any suggestions ??

Former Member
0 Likes

Hi,

Actual syntax is as below:

INSERT ALL

  INTO suppliers (supplier_id, supplier_name) VALUES (1000, 'IBM')

  INTO suppliers (supplier_id, supplier_name) VALUES (2000, 'Microsoft')

  INTO suppliers (supplier_id, supplier_name) VALUES (3000, 'Google')

SELECT * FROM dual;

Now in your non working query, you have applied comma after first INTO statement.

Please remove it.

Thanks,

Swapnil

Former Member
0 Likes

Thanks @Swapnil. the query worked.

Answers (1)

Answers (1)

Former Member
0 Likes

Hi Debasree,

Could you please split the INSERT ALL statement and check if they are working individually.

I see in the screenshot you are missing select * from dual; for first insert all statement. The error also suggests the same thing(Missing Select...)

Regards

Arun Sasi

Former Member
0 Likes

Thanks Arun,

As I mentioned before, if I split the command individually its working fine.

select * from dual is there in both statements.

Thought of using INSERT ALL to avoid multiple calls to db.