Unanswered: ORA-01007: variable not in select list (Err in accessing dynamically altered table)
Hi All, This is Kushal
I am a new user to this group.
I am facing a problem.
Problem :- I have written a stored procedure in which the structure of one table is decided at runtime. Now I am querying that table through a cursor. My problem is The cursor opens everytime properly for one parameter value but it gives error the very first time for other parameter value. Now if I execute it again for the same parameter value it runs without any error
Do please help. I have given comment at the point where error is coming
A Part of my prcedure is :---
PROCEDURE BUILD_TEMP_COMM_SCHEDULE(SERVICE_MST_FK_IN IN NUMBER)
Some Cursors are defined here
CURSOR CUR_NPC_SCHEDULE IS SELECT * FROM TEMP_COMMERCIAL_SCHEDULE TC_Sch ORDER BY TC_Sch.SNO;
/* Note :-- SNO field is never changed in TEMP_COMMERCIAL_SCHEDULE */
You can't perform static SQL (i.e. your cursor) against a table definition that is defined dynamically. The column list for the cursor is determined at compile time, and does not "update" to reflect any alterations made dynamically after that. So you will need to use dynamic SQL and a REF CURSOR.