#1 25 Apr 2008 07:46

Shrichandray
Member
Registered: 25 Apr 2008
Posts: 1

Need an example of Anonymous block that has used Array.

This is first time I m posting something for discussion. Please guide with an working eg.
My requirement is like below.



v_userlist   Array['xyz','abc','sdf','fgh','ert']

for loop

  Want to process these Array values to print in DBMS_OUTPUT.

end loop

Offline

#2 20 May 2008 12:02

rameshprabhukn
Member
Registered: 20 May 2008
Posts: 1

Re: Need an example of Anonymous block that has used Array.

I think the below will solve your problem.

DECLARE
i NUMBER := 0;
     TYPE var_tab IS VARRAY(10) OF VARCHAR2(40);
   values_nos var_tab := var_tab('a','b','c','d','e','f','g');
BEGIN
     values_nos (1) := 'xyz';
     values_nos (2) := 'kli';
     values_nos (3) := 'sdf';
     values_nos (4) := 'fgh';
     values_nos (5) := 'ert';
    LOOP
        i :=i+1;    
          DBMS_OUTPUT.PUT_LINE('Value_no(1) is '||values_nos(i));
                EXIT WHEN i=5;
          END LOOP;
           END;


Regards,
RameshKN

Offline

Board footer

Powered by FluxBB