如何将对列表传递给Oracle存储过程?

jju*_*uma 2 sql oracle plsql

我想写一个Oracle PL/SQL存储过程,它将一些其他类型的对列表作为参数varchar2(32).这可能吗?最好的方法是什么?

Jus*_*ave 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.
Run Code Online (Sandbox Code Playgroud)

显然,实际上,函数会对传入的数组做一些事情,但这是一般的想法.