Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Object Oriented
 

Table Functions with table of numbers

SQL>  create or replace type numberTableType is table of number;   2  / Type created. SQL> SQL> create or replace function f_table return numberTableType   2  is   3    v_numarray numberTableType :=numberTableType();   4  begin   5    FOR i in 1..10 loop   6      v_numarray.EXTEND;   7      v_numarray(i):=i+100;   8    END LOOP;   9    RETURN (v_numarray);  10  end;  11  / Function created. SQL> SQL> SELECT * FROM TABLE(f_table); COLUMN_VALUE ------------          101          102          103          104          105          106          107          108          109          110 10 rows selected. SQL>