Change variable name dynamically.
RaghuJun 17 2012 — edited Jun 18 2012Hi 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.