Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Change variable name dynamically.

RaghuJun 17 2012 — edited Jun 18 2012
Hi i am executing below code and getting error.

DECLARE
DELI_COUNT1 NUMBER;
ITEM1 NUMBER;
ERRLINE NUMBER;
CQUERY VARCHAR2(2000);
ICOUNT NUMBER;
BEGIN

DELI_COUNT1 := 1;

FOR I IN 1 .. DELI_COUNT1
LOOP
---- PROCESS TO READ data and assing into variabe.
-- insert into test_raghu values (L_COUNTER , DELI_COUNT );
AD_DEBUG (ERRLINE || 'COUNT OF CHAR ' || DELI_COUNT1);
ERRLINE := 5;
--POS1 := instr();
ITEM1 := '1';
iCOUNT := I;
ERRLINE := 6;
cQUERY := 'begin ITEM'|| i || ' := 1; end;';
EXECUTE IMMEDIATE cQUERY;
END LOOP ;
END;
/



Error
PLS-00201: identifier 'ITEM1' must be declared..


What i want to achive is to change the variable nameto which i am assigning values run time based on the FOR LOOP count.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 16 2012
Added on Jun 17 2012
11 comments
1,240 views