Oracle 嵌套表和列名
我想在 Oracle 10g 中执行以下操作(这是一个人为的示例,用于展示概念,而不是真实的代码)
create table orders (order_id NUMBER);
insert into table orders values (1);
insert into table orders values (2);
insert into table orders values (3);
TYPE NUMBER_ARRAY_T is TABLE of NUMBER;
PROCEDURE VALIDATE_ORDER_IDS(i_orders IN NUMBER_ARRAY_T, o_output OUT SYS_REFCURSOR)
IS
BEGIN
OPEN o_output FOR
select ??? from TABLE(i_orders) where ??? NOT IN (select order_id from orders);
END VALIDATE_ORDER_IDS;
存储过程将使用包含 (1,2) 的数组进行调用,我们期望返回 3因此
,问题是,是否有办法指定一个列名,其中 ???当使用嵌套表作为表时,上面的 select 语句会起作用吗?
I'd like to do the following in Oracle 10g (this is a contrived example to show the concepts, not real code)
create table orders (order_id NUMBER);
insert into table orders values (1);
insert into table orders values (2);
insert into table orders values (3);
TYPE NUMBER_ARRAY_T is TABLE of NUMBER;
PROCEDURE VALIDATE_ORDER_IDS(i_orders IN NUMBER_ARRAY_T, o_output OUT SYS_REFCURSOR)
IS
BEGIN
OPEN o_output FOR
select ??? from TABLE(i_orders) where ??? NOT IN (select order_id from orders);
END VALIDATE_ORDER_IDS;
The stored procedure would be called with an array containing (1,2) and we'd expect to get 3 back as a result
So, the question is, is there anyway to specify a column name where the ??? are when using a nested table as a table, so the above select statement would work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要查找的关键字是
column_value
。根据您的设置:要调用该过程,您只需:
The keyword you're looking for is
column_value
. With your setting:To call the procedure you would simply: