plsql - Handle two different queries with one ref cursor -
i have 2 select queries , wanted open cursor both of them ?
v_str1:='select rowid ' || p_tblname|| 'where '|| p_cname||'='''|| p_cvalue || ''''; v_str2:='select count ( * ) v_cnt ' || p_tblname|| 'where '|| p_cname||' = '''||p_cvalue||'''';
.....
open ref_cur_name v_str1 loop
if v_cnt = 1 exit; else execute immediate 'delete '|| p_tblname|| 'where rowid = rec.rowid'; end if; v_cnt := v_cnt - 1;
end loop;
first query select statement , other puts count v_cnt
. need execute both of these queries . there way use both these queries ? also there syntax error after open
statement i.e . @ loop.
use execute immediate
execute immediate 'select count ( * ) v_cnt ' || p_tblname|| 'where '|| p_cname||' = '''||p_cvalue||'''';
Comments
Post a Comment