oracle - 在 oracle 中使用嵌套表打印元素
问题描述
我正在研究一个具有两个集合类型参数的过程。
样本数据:
accounts
accountid
2
3
4
rts_accounts
accountid
2
3
5
输入: 1,2,3,4,5
所需输出: 4,5
我知道我们可以通过普通的 sql 来实现它,但我希望它包含在一个集合中,因为我们的表有数百万条记录。请有人帮助我使用收集方法解决此问题。
到目前为止我的代码:
create or replace PROCEDURE delete_account_stg (
in_accounts IN test_coll,
out_accounts OUT test_coll)
IS
result_coll test_coll;
result1_coll test_coll;
BEGIN
SELECT test_type( account_id )
BULK COLLECT INTO result_coll
FROM table(in_accounts);
select test_type(a.account_id )
bulk collect into result1_coll
from accounts a inner join rts_accounts b on a.account_id = b.account_id;
select result_coll MULTISET except result1_coll into out_accounts from dual;
END delete_account_stg;
我得到的输出为:
1,4,5
但我想要4,5
.
解决方案
推荐阅读
- php - instagram profile scraper - 重定向到登录页面 [PHP]
- windows - 如何在 shelljs 中获取 microsip 或其他 Windows 终端全局应用程序?
- python - Pandas ValueError:尝试添加新列时无法从重复轴重新索引
- pytorch - 在 Google Colab 上运行 pytorch 的队列系统。如何在不重新启动运行时可靠地清除 CUDA 内存?
- python - Flask:如何呈现模板并保存 request.headers 信息?
- excel - 粘贴到所有工作表,前 6 个除外
- android - Kotlin 将比特币价值转换为 Satoshi 价值
- node.js - Heroku没有更新项目
- python - 无法在 Colab 中加载图像目录
- discord.js - CLIENT_MISSING_INTENTS 与 d.js