我想编写一个Oracle PL / SQL存储过程,该过程将一些其他类型的对列表作为参数,比如varchar2(32)
。这可能吗?最好的方法是什么?
答案 0 :(得分:6)
听起来你只想传递一个集合,即
SQL> create type point as object (
2 x_coordinate number,
3 y_coordinate number );
4 /
Type created.
SQL> create type point_array
2 is
3 table of point;
4 /
Type created.
SQL> create procedure interpolate( points IN point_array )
2 as
3 begin
4 null;
5 end;
6 /
Procedure created.
SQL> declare
2 points point_array := point_array( point(0,1), point(1,1) );
3 begin
4 interpolate( points );
5 end;
6 /
PL/SQL procedure successfully completed.
显然,实际上,该函数会对传入的数组执行某些操作,但这是一般的想法。