| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.misc -> Help,Declare a cursor in stored procedure.
Hi, all,
Inside stored procudure, how do I declare a cursor based on a table to be create before the cursor is declared ? Since the table doesn't exist, I got compiling error. Is there a way work out this? Here is what I did:
CREATE OR REPLACE PROCEDURE DoSomething([Parameter list]) IS
	.....
BEGIN
	.....
	.....
	/* Dynamic create table by using DBMS_SQL package */
	create_object('table', 'my_table_a', sub_query);
	DECLARE
		CURSOR a_cur
		IS
			SELECT a1,a2,..,an FROM my_table_a
			WHERE .....;
	BEGIN
		/* Do something here */
	END;
Shaojie Hu Received on Thu Mar 13 1997 - 00:00:00 CST
|  |  |