Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Variable for column name
dan_beatty_at_my-deja.com wrote in message <7v58hp$nom$1_at_nnrp1.deja.com>...
<snipped>
>What I want to do is use the v_field_name as follows:
>
> UPDATE new_table
> SET v_field_name = :NEW.udf
>
This can not be parsed by Oracle as "v_field_name" contains a variable. Does it refer to a numeric, date or varchar? How does Oracle check that the column name is valid? Etc.
The only way for Oracle to parse this is to do it at runtime - not possible in a normal PL/SQL block where the parsing is done at compilation time. The solution is to use dynamic SQL in a PL/SQL block (there's a DBMS SQL package that supports it). The PL/SQL manual also describes dynamic SQL I think.
regards,
Billy
Received on Wed Oct 27 1999 - 03:56:46 CDT