试试这个:
declare
ac_qfny varchar2(10):='qf12';
ac_dw varchar2(4):='C6';
v_sql_string varchar2(500);
begin
v_sql_string := 'update jczj_c_dfxx a set ysdf=(select '||ac_qfny ||'from
dq.dfsqf b where a.hh=b.hh) where dw=:v1'; execute immediate v_sql_string USING ac_dw;
end;
/
declare
ac_qfny varchar2(10):='qf12';
ac_dw varchar2(4):='C6';
v_sql_string varchar2(500);
begin
v_sql_string := 'update jczj_c_dfxx a set ysdf=(select '||ac_qfny ||'from
dq.dfsqf b where a.hh=b.hh) where dw=:v1'; execute immediate v_sql_string USING ac_dw;
end;
/
from dq.dfsqf b where a.hh=b.hh) where dw='||ac_dw;
改为以下:
from dq.dfsqf b where a.hh=b.hh) where dw='|| ''' || ac_dw || '''; 说明:
应该把 C6 用'号括起来,