Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> help for execute immediate

help for execute immediate

From: ajay <ajaym259_at_yahoo.com>
Date: 17 Jan 2006 21:27:03 -0800
Message-ID: <1137562023.148170.258950@g49g2000cwa.googlegroups.com>


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'

||' 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
Received on Tue Jan 17 2006 - 23:27:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US