oracle 表单在插入之前或之后循环通过一个块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16411086/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:38:37  来源:igfitidea点击:

oracle forms loop through a block before or after insert

oracleoracleforms

提问by Adeel Aslam

I am trying to insert values of A block into a table in oracle forms after insert like this

我试图在插入后以 oracle 形式将 A 块的值插入到表中

GO_BLOCK ('LCL_SP_DTL');
   LAST_RECORD;
   LV_N_LAST_REC := :SYSTEM.TRIGGER_RECORD;
   FIRST_RECORD;
   LV_N_FST_REC := :SYSTEM.TRIGGER_RECORD;

   FOR I IN LV_N_FST_REC .. LV_N_LAST_REC
   LOOP
      INSERT INTO LEDGER(LDATE, LTYPE, DESCRIPTION, DEBIT, CREDIT, SID,VID)
           VALUES (:LCLSP_MST.REC_DATE, 'Local Sale', DES, 0, AMOUNT, LS_ID,'LS-' || :LCLSP_MST.REC_ID);
      NEXT_RECORD;
   END LOOP;

But its gving me error not working properly .Plz give any suggestion to insert values in LEDGERon runtime

但它给我的错误不能正常工作。请给任何建议LEDGER在运行时插入值

回答by Jeffrey Kemp

You are using :SYSTEM.TRIGGER_RECORD, which is the record number where your code originated. It doesn't change just because you've navigated to another record. In other words, your LV_N_LAST_RECand LV_N_FST_RECwill be set to the same value.

您正在使用:SYSTEM.TRIGGER_RECORD,这是您的代码来源的记录号。它不会因为您导航到另一条记录而改变。换句话说,您的LV_N_LAST_RECLV_N_FST_REC将被设置为相同的值。

You coulduse :SYSTEM.CURRENT_RECORDI think, but a better solution is the traditional forms record loop:

我认为您可以使用:SYSTEM.CURRENT_RECORD,但更好的解决方案是传统的表单记录循环:

GO_BLOCK ('LCL_SP_DTL');
FIRST_RECORD;
LOOP
  INSERT INTO LEDGER(LDATE, LTYPE, DESCRIPTION, DEBIT, CREDIT, SID,VID)
       VALUES (:LCLSP_MST.REC_DATE, 'Local Sale', DES, 0, AMOUNT, LS_ID
              ,'LS-' || :LCLSP_MST.REC_ID);
  EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
  NEXT_RECORD;
END LOOP;