0

When I run the following it executes just fine

WITH temp AS ( SELECT owner, table_name FROM all_tables )
SELECT * FROM temp;

When I then add a BEGIN-END block it does not work anymore

BEGIN
    WITH temp AS ( SELECT owner, table_name FROM all_tables )
    SELECT * FROM temp;
END;  

The error message is:

an INTO clause is expected in this SELECT statement

Can anyone explain what is going on here and why the WITH statement needs to be amended?

Simon
  • 39
  • 3
  • 3
    It's not the `WITH` clause. You would get this self-explanatory error for any `select` without an `into` clause. – William Robertson Jun 13 '18 at 07:30
  • 4
    When you run `SQL` statement under the scope of `PLSQL` engine, you need variables to hold the result of select statement and you capture those using `INTO` clause. – XING Jun 13 '18 at 07:33

0 Answers0