函数内部变量,每次调用时应该是空的.如果你没把握,可以在定义时置空. .... is n_str varchar2(200) := null; begin ....
begin n_str:=''; n_str:='creat global temporary table zw_regcntsubscrb as '; n_str:='select subscrb_id,acct,pay_phone from yy_subscrb'; execute immediate n_str; end; 直接插入不是好点么?
v_id integer; begin v_sql := ''; v_sql := 'select id from table '; execute immediate v_sql into v_id; end;
还有因后面语句还要拼凑动态sql,所以n_str变量要复用,用‘/0’方式清空变量是否合适?
....
is
n_str varchar2(200) := null;
begin
....
n_str:='';
n_str:='creat global temporary table zw_regcntsubscrb as ';
n_str:='select subscrb_id,acct,pay_phone from yy_subscrb';
execute immediate n_str;
end;
直接插入不是好点么?
begin
v_sql := '';
v_sql := 'select id from table ';
execute immediate v_sql into v_id;
end;
问题2:清空n_str直接负''就行了 n_str=''