Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Laszlo.

Asked: June 12, 2024 - 9:06 am UTC

Last updated: June 12, 2024 - 10:02 am UTC

Version: 16

Viewed 1000+ times

You Asked

Is it possible to use array as a procedure parameter?

and Chris said...

Yes:

create or replace type nt_arr is table of number;
/

create or replace procedure p ( 
  arr1 nt_arr, arr2 dbms_sql.number_table
) as 
begin 
  for i in 1 .. arr1.count loop
    dbms_output.put_line ( arr1(i) );
  end loop;

  for i in 1 .. arr2.count loop
    dbms_output.put_line ( arr2(i) );
  end loop;
end;
/

exec p ( arr1 => nt_arr ( 1, 2 ), arr2 => dbms_sql.number_table ( 4, 5 ) ) ;
1
2
4
5


Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library