Oracle формирует 10g, копирует несколько строк в другой блок - PullRequest
1 голос
/ 30 октября 2019

Я новичок в формах оракула и у меня проблема. У меня есть два блока с несколькими записями с одинаковыми полями в форме.

Я запрашиваю данные для одного блока, он заполняется. После этого мне нужно скопировать все строки в новый блок. Один полезный парень предложил следовать, но это держит меня в бесконечном цикле. Можете ли вы помочь мне решить эту проблему? :

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;



1 Ответ

1 голос
/ 30 октября 2019
if :system.last_record = 'true' then

: system.last_record возвращает TRUE или FALSE (в верхнем регистре), поэтому этот оператор IF никогда не будет истинным. Значение true в кавычках должно быть TRUE.

...