Skip to content
Advertisement

How do I use both a SELECT query and RETURNING inside the same SQLPLUS INSERT INTO statement

I’m working on this project I’m using sqlplus and I’m making this procedure in PL/SQL:

I just get the error: SQL command not ended properly. I can’t find any information online about how to properly do this. I tried to have t_order_no as a table. I tried having it RETURNING BULK COLLECT INTO. I tried putting the RETURNING before the select. I don’t know what else to try anymore. Does anyone have any suggestions?

Advertisement

Answer

That’s because – in PL/SQL – you can’t use RETURNING with SELECT:

It works only for VALUES:


Here’s an example:

This won’t work:

But this will:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement