我想编写一个 Oracle PL/SQL 存储过程,它将其他类型的对列表作为参数,例如 varchar2(32)
。这可能吗?最好的方法是什么?
最佳答案
听起来您只想传递一个集合,即
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.
显然,实际上,该函数会对传入的数组执行某些操作,但这是总体思路。
关于sql - 如何将对列表传递给 Oracle 存储过程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3961344/