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

标签 sql oracle plsql

我想编写一个 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/

相关文章:

sql - 在 postgres 表中跨所有唯一阈值运行 "distinct on"

mysql - 在一个查询中连接 3 个 mySQL 表

sql - EXCEPTION 后继续 MERGE

node.js - 如何在 Node.js 项目中完美使用 Oracle DB

xml - PLSQL 从 XML 读取值?

sql - 加入靶场的最佳方式?

sql - 数据库的执行计划

sql - oracle 11g xe 用户数据

oracle - 这就是非批量绑定(bind) PL/SQL 代码应如何转换为批量绑定(bind)代码的方式吗?是否有理由放弃 buk 绑定(bind)?

sql - Crystal Reports 需要按派生日期范围分组