简体   繁体   English

在oracle表单中插入Record

[英]Inserting Record in oracle forms

I'm working with Oracle Forms Builder, and I've a block with several records. 我正在使用Oracle Forms Builder,我有一个包含多个记录的块。 The code looks somewhat like this 代码看起来有点像这样

first_record;
IF NAME_IN('SYSTEM.LAST_RECORD') != 'TRUE' THEN                                 
  LOOP                  
    IF name_in('QOTLNDET_LINES.SERIAL_NUMBER') IS NOT NULL THEN                         
      QOTLNDET_LINES_REMOVE.Delete_Row;
      clear_record;     
    ELSE                    
      next_record;
    END IF;
    EXIT WHEN NAME_IN('SYSTEM.LAST_RECORD') = 'TRUE';

  END LOOP;
  execute_query;
  COMMIT;
  go_block('QOTHDDET_MAIN');
END IF; 

Right before the next_record, inside the ELSE segment, I need to remove the current record and re-insert it. 在next_record之前,在ELSE段内,我需要删除当前记录并重新插入它。 The problem isn't removing the record, it's re-inserting it. 问题不在于删除记录,而是重新插入记录。 Any ideas? 有任何想法吗? Thanks in advance. 提前致谢。

I agree with APC, instead of re-inserting the record which means deleting and then inserting it again, a simpler approach would be to just update the fields in the DB (or non-DB) Block. 我同意APC,而不是重新插入记录,这意味着删除然后再次插入,更简单的方法是更新DB(或非DB)块中的字段。 Something like- 就像是-

Go_Block('Block_B1');
Last_Record;
L_num_records := :system.cursor_record;
FOR i in 1..L_num_records
LOOP    
     Go_Block('Block_B1');
     Go_Record(i);
     --update the fields in the row
     :Block_B1.item1 := 'Set your value';
     :Block_B1.item2 := 'Set your value';
     ...
     ...
     Next_Record;
END LOOP;
First_Record;

I agree with APC and Annjawn that the update seems to be the correct way to go. 我同意APC和Annjawn认为更新似乎是正确的方法。 When looking in your code it seems like you have your code in a pll library. 在查看代码时,您似乎将代码放在pll库中。 This when you are using the name_in() instead of directly referencing the item. 当您使用name_in()而不是直接引用该项时。 If this is true then means that you naturally can't use the direct reference when assigning the value to the item. 如果这是真的,则意味着在将值分配给项目时,您自然无法使用直接引用。 Instead you have to use the copy(). 相反,你必须使用copy()。 It's some time since I have used name_in() and copy() but something like this should work: 这已经有一段时间了,因为我使用了name_in()和copy(),但这样的事情应该有效:

IF NAME_IN('SYSTEM.LAST_RECORD') != 'TRUE' THEN                                 
  LOOP                  
    IF name_in('QOTLNDET_LINES.SERIAL_NUMBER') IS NOT NULL THEN                         
      QOTLNDET_LINES_REMOVE.Delete_Row;
      clear_record;     
    ELSE        
      Copy('new value', 'QOTLNDET_LINES.INVENTORY_ITEM');

      next_record;
    END IF;
    EXIT WHEN NAME_IN('SYSTEM.LAST_RECORD') = 'TRUE';

  END LOOP;
  execute_query;
  COMMIT;
  go_block('QOTHDDET_MAIN');
END IF; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM