Home » SQL & PL/SQL » SQL & PL/SQL » Dynamic sql (Oracle 10g)
Dynamic sql [message #321985] Thu, 22 May 2008 00:58 Go to next message
subbu_tce
Messages: 98
Registered: July 2007
Location: pune
Member
Am having a function
CREATE OR REPLACE FUNCTION passCursor
	   	  	(
			 c_otc sys_refcursor
		  )
RETURN BOOLEAN
AS
 BEGIN
	RETURN TRUE;
END;
/
Am using dynamic sql as
DECLARE
lproc_name VARCHAR2(100):='passCursor';
CURSOR c IS SELECT * FROM ktc_airBkDtls;
BEGIN
    EXECUTE IMMEDIATE 'Declare a boolean;  BEGIN a:='|| lproc_name || '(:x);END;' USING IN c;
END;

Am getting errors as incomplete or malformed.
Can you please give me the solution

[Updated on: Thu, 22 May 2008 01:13] by Moderator

Report message to a moderator

Re: Dynamic sql [message #321988 is a reply to message #321985] Thu, 22 May 2008 01:17 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
"c" is a cursor not a ref cursor.

SQL> DECLARE
  2  lproc_name VARCHAR2(100):='passCursor';
  3  c sys_refcursor;
  4  begin
  5    open c for 'select * from emp';
  6    EXECUTE IMMEDIATE 'Declare a boolean;  BEGIN a:='|| lproc_name || '(:x);END;' USING IN c;
  7  end;
  8  /

PL/SQL procedure successfully completed.


Next time, please format your code using code tags: read OraFAQ Forum Guide, "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Use the "Preview Message" button to verify.

Regards
Michel
Previous Topic: Concurrency problem in cursor
Next Topic: Problem:How to supress Duplucate in output
Goto Forum:
  


Current Time: Thu Dec 08 14:49:40 CST 2016

Total time taken to generate the page: 0.08873 seconds