Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> help for execute immediate
hi i am writing a new stored procedure. the error i am gettin g is i
have a variable whereclause
in this i have an and clause as
whereclause := ' AND usr.act_key IN (SELECT DISTINCT act2.act_key FROM' ||
' act act2, aad, usg, ugp, usr usr5' || ' WHERE usr5.act_key = aad.act_key' || ' and aad.ugp_key = usg.ugp_key' || ' and ugp.ugp_key = usg.ugp_key' || ' and usg.usr_key = ' || ' intuserkey_in)';
in am using the same in my execute immediate statement but not getting the desired result
EXECUTE IMMEDIATE 'SELECT count(*)'
||' FROM usr,'
|| ' act,' || ' oiu,' || ' obi,' || ' obj,' || ' ugp,' || ' usg,' || ' aad,' || ' oug'Received on Tue Jan 17 2006 - 23:27:03 CST
||' WHERE usr.act_key = act.act_key'
||' AND usr.usr_key = oiu.usr_key'
||' AND oiu.obi_key = obi.obi_key'
||' AND obi.obj_key = obj.obj_key'
||' AND usg.usr_key = usr.usr_key'
||' AND usg.ugp_key = ugp.ugp_key'
||' AND aad.act_key = act.act_key'
||' AND aad.ugp_key = ugp.ugp_key'
||' AND obj.obj_key = oug.obj_key'
||' AND oug.ugp_key = ugp.ugp_key'
|| whereclause INTO inttotalrows_out; the problem is whereclause variable is not getting appended to statement can any body help