【发布时间】:2020-02-25 11:50:11
【问题描述】:
我是 Oracle 表单的新手,但遇到了问题。 我在表单中有两个具有相同字段的多记录块。
我查询一个块的数据,它被填充了。
在哪里可以将所有行从填充块复制到“复制”块?
【问题讨论】:
标签: oracle plsql oracle10g oracleforms
我是 Oracle 表单的新手,但遇到了问题。 我在表单中有两个具有相同字段的多记录块。
我查询一个块的数据,它被填充了。
在哪里可以将所有行从填充块复制到“复制”块?
【问题讨论】:
标签: oracle plsql oracle10g oracleforms
是的,有办法。一种是在那里手动输入这些值,但这可能不是您想要的。
另一个是创建一个按钮(我们称之为BTN_COPY)并在其上创建WHEN-BUTTON-PRESSED触发器。它看起来像下面的代码(基于属于 Scott 的EMP 表的项目);请注意,我无法对其进行测试,但是 - 我希望一切都会好起来的。
declare
-- local variables; should contain all items you'd want to copy
l_empno emp.empno%type;
l_ename emp.ename%type;
l_job emp.job%type;
-- l_currec will contain current row number in the first block
l_currec number := 0;
-- l_exit will be used if we're at the end of the first block
l_exit varchar2(1) := 'N';
begin
loop
-- go to the source (first block) and the [last row you were in + 1]
go_block('first');
l_currec := l_currec + 1;
go_record(l_currec);
-- check whether this is the last row of the first block; if so, exit the loop
if :system.last_record = 'TRUE' then
l_exit := 'Y';
end if;
-- save current row's items
l_empno := :first.empno;
l_ename := :first.ename;
l_job := :first.job
-- go to the second block's bottom and create a new record
go_block('second');
last_record;
create_record;
-- put stored values into the second block's items
:second.empno := l_empno;
:second.ename := l_ename;
:second.job := l_job;
-- exit the loop if this was the last record to be copied
exit when l_exit = 'Y';
end loop;
end;
【讨论】: