COLUMN
is an SQL*Plus client construct, and the dynamic SQL is running inside the PL/SQL engine, so there's no real connection. I'm not sure where you'd document something not applying.
The closest I can think of for this - assuming you're doing this to have the results of your dynamic SQL available to plan SQL statements later in a script - is using bind variables instead:
var x varchar2(30);
BEGIN
EXECUTE IMMEDIATE 'SELECT ''a'' x FROM dual' INTO :x;
END;
/
select :x from dual;
You can use :x
anywhere you'd have used &x2
, but bear in mind that because it's a bind variable you don't need to put it in single quotes (if it's a varchar) when you use it; if you did this:
select ':x' from dual;
... then you'd back the literal string :x
, not a
.
Edited to add
If you particularly need the &
form, you can do a further step (untested, but can't see why not):
column x2 new_value x3
select :x as x2 from dual;
... and you'll have &x3
available.