1

我有一个多行块,在 oracle 形式中看起来像这样:

在此处输入图像描述

我的查询:

Select * from table1;

看起来像这样:

+-----+
|value|
+-----+
|    3|
|    3|
|    7|
|    1|
+-----+

是表中要更新为列new的列:

在此处输入图像描述

这样当我重新查询时,我表上的值应该是这样的:

+-----+
|value|
+-----+
|    4|
|    6|
|   14|
|    2|
+-----+

我尝试过提交表单提交:

for i in 1 .. :rec_count
loop
    update table1
    set value = :new
    where value = :value;
end loop;

但这只会更新我拥有的最后一条记录。

4

1 回答 1

1

通过WHEN-BUTTON-PRESSED智能触发器使用以下代码从按钮中的first_recordnext_record内置函数使用while 循环可能是正确的:

declare
   v_blk varchar2(25) := 'block1';
begin   
   go_block(v_blk);
   first_record;
 while ( :value is not null ) 
 loop
  :value := :value + nvl(:added_value,0);
   next_record;
 end loop;

   commit_form;    

   go_block(v_blk);
   execute_query;
end;
于 2018-05-29T13:13:09.373 回答