我是oracle表单的新手,我遇到了问题。我在表单中有两个具有相同字段的多个记录块。
我查询一个数据块,它被填充。之后,我需要将所有行复制到新块。一位乐于助人的人建议追随,但这使我陷入无尽的循环。你能帮我解决这个问题吗?:
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;
end;
if :system.last_record = 'true' then
:system.last_record返回'TRUE'或'FALSE'(大写),因此该IF语句永远不会为真。引号中的“ true”必须为“ TRUE”。