2010년 4월 5일 월요일

simple VARRAY example


DECLARE
  TYPE
Str_Array IS VARRAY(4) OF VARCHAR2(50);
  v_array  
Str_Array;

  PROCEDURE PROCESS_ARRAY
(v_str_array  Str_Array)
  AS
 
BEGIN
    FOR i IN v_str_array
.first .. v_str_array.last LOOP
      DBMS_OUTPUT
.PUT_LINE('Hello '||v_str_array(i));
   
END LOOP;
 
END;

BEGIN

  v_array
:= Str_Array('John','Paul','Ringo','George');

  PROCESS_ARRAY
(v_array);

 
-- can also pass unbound Str_Array
  PROCESS_ARRAY
(Str_Array('John','Paul','Ringo','George'));

END;

댓글 없음:

댓글 쓰기