oracle - 带有 forloop 和包含检查的 PLSQL 过程
问题描述
我尝试做的是:将 2 个信号的自定义合并过程实现为结果信号。
从 rs = s2 开始。将 SIGNAL1 中的所有自定义字段复制到 SIGNAL2 中不存在的 RESULTSIGNAL(即不存在具有相同 ID 的自定义字段)。
"custom_fields"
inSIGNAL_STRUCT
是 custom_fields_table 的一种类型
我的程序签名看起来像这样
PROCEDURE signal_merge(s1 IN SIGNAL_STRUCT, s2 IN SIGNAL_STRUCT, rs OUT SIGNAL_STRUCT)
我实现这一点的伪代码是:
for custom_field : s1.custom_fields
if(custom_field.cf_id NOT CONTAINS IN s2.custom_fields)
rs.custom_fields ADD s1.custom_field
我找不到合适的语法。有人可以告诉我如何实现这一点吗?
更新:根据评论中的要求
create or replace TYPE SIGNAL_STRUCT AS OBJECT
id NUMBER (38),
emission_type NUMBER(19),
custom_fields custom_fields_table
create or replace TYPE custom_fields_struct FORCE
AS
OBJECT
(
field_id VARCHAR2 (128 CHAR),
field_value NUMBER (1)) FINAL ;
create or replace TYPE custom_fields_table FORCE
IS
TABLE OF wf_bool_custom_fields_struct ;
更新:示例 S1 具有自定义字段
- “f1”
- “f2”
S2 有自定义字段
- “f3”
- “f4”
第一步:rs = s2 第二步:运行合并
Result:结果信号(rs)的自定义字段表,合并后必须有
- “f1”
- “f2”
- “f3”
- “f4”
解决方案
推荐阅读
- google-maps - 从谷歌地图链接获取坐标
- vue.js - 将数据从 Vuex getter 传递到组件 prop
- python - 如何知道滚动条在 selenium python 中结束
- javascript - 如何制作简单的商品结账
- python-3.x - (没有名为 sqlalchemy 的模块)但是为什么我已经安装了它
- azure-data-factory - 是否可以从映射数据流中更新管道参数值?
- mongodb - 数据库未根据 Challengeschema 的变化进行更新
- docker - LogStash 无法从许可证中检索许可证信息。响应代码“401”通过 URL“http://elasticsearch:9200/_xpack”联系 Elasticsearch
- java - spring-boot 1.5.4 spring 云流手动偏移提交行为,如果消费者(kube pod)重新启动
- python - 在分组数据框中按条件计数