oracle 表单获取 table 和多行块中的数据
oracle forms get data that are both in table and multi row block
我有一个 table 看起来像这样
+-------+
|stud_id|
+-------+
|10 |
|13 |
|12 |
|11 |
|15 |
+-------+
和这样的多行块
我想要的是,例如,在我的多行块中单击按钮后,我的值是 13、12、14,将出现一条消息,其中包含 stud_id,它们都在我的 table 和多行块块,它们只是数字 13 和 12 而不是 14,因为它不包含在我的 table.
中
表格形式(包含多行的表格)是基于一些 table,我想。我们称它为 FORM_TBL
。另外,假设包含您 post 编辑的数据的 table 名称称为 STUD_TBL
。
一个简单的选择是将 post 数据输入到表单中(这意味着它们最终会出现在 table 中,但不会'不要提交,除了你会看到那些行之外没有人)然后 - 使用 INTERSECT
集合运算符 - 找到共同的价值。那将是 WHEN-BUTTON-PRESSED
触发器:
declare
retval varchar2(200);
begin
post;
select listagg(stud_id, ',') within group (order by stud_id)
into retval
from (select stud_id from stud_tbl
intersect
select s_id from form_tbl
);
message('Common values: ' || retval);
end;
如果您的表单版本不支持LISTAGG
,您可以循环执行:
declare
retval varchar2(200);
begin
post;
for cur_r in (select stud_id from stud_tbl
intersect
select s_id from form_tbl
)
loop
retval := retval ||', '|| cur_r.stud_id;
end loop;
message('Common values: ' || retval);
end;
否则,如果 POST
不能满足您的需求,您将不得不遍历表单中的所有行并检查它们是否存在于 STUD_TBL
中。
我有一个 table 看起来像这样
+-------+
|stud_id|
+-------+
|10 |
|13 |
|12 |
|11 |
|15 |
+-------+
和这样的多行块
我想要的是,例如,在我的多行块中单击按钮后,我的值是 13、12、14,将出现一条消息,其中包含 stud_id,它们都在我的 table 和多行块块,它们只是数字 13 和 12 而不是 14,因为它不包含在我的 table.
中表格形式(包含多行的表格)是基于一些 table,我想。我们称它为 FORM_TBL
。另外,假设包含您 post 编辑的数据的 table 名称称为 STUD_TBL
。
一个简单的选择是将 post 数据输入到表单中(这意味着它们最终会出现在 table 中,但不会'不要提交,除了你会看到那些行之外没有人)然后 - 使用 INTERSECT
集合运算符 - 找到共同的价值。那将是 WHEN-BUTTON-PRESSED
触发器:
declare
retval varchar2(200);
begin
post;
select listagg(stud_id, ',') within group (order by stud_id)
into retval
from (select stud_id from stud_tbl
intersect
select s_id from form_tbl
);
message('Common values: ' || retval);
end;
如果您的表单版本不支持LISTAGG
,您可以循环执行:
declare
retval varchar2(200);
begin
post;
for cur_r in (select stud_id from stud_tbl
intersect
select s_id from form_tbl
)
loop
retval := retval ||', '|| cur_r.stud_id;
end loop;
message('Common values: ' || retval);
end;
否则,如果 POST
不能满足您的需求,您将不得不遍历表单中的所有行并检查它们是否存在于 STUD_TBL
中。