oracle 循环遍历Oracle表单中datablock的所有记录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14964649/
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-10 04:52:15  来源:igfitidea点击:

Loop through all the records of datablock in Oracle forms

formsoracle

提问by skujins

I am trying to learn Oracle forms (v6.0). In a when-button-pressed trigger I am trying to loop through all of the records from a datablock. So far I have following code:

我正在尝试学习 Oracle 表单 (v6.0)。在按下按钮时的触发器中,我试图遍历数据块中的所有记录。到目前为止,我有以下代码:

BEGIN
    GO_BLOCK('MY_BLOCK');
    FIRST_RECORD;
    LOOP
    MESSAGE(:MY_BLOCK.DSP_NAME);
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    NEXT_RECORD;            
    END LOOP;   
END;

When I run the code all the DSP_NAME values are displayed except the last one. If I add :

当我运行代码时,除了最后一个之外,所有 DSP_NAME 值都会显示出来。如果我添加:

MESSAGE(:MY_BLOCK.DSP_NAME);

after the loop, then the DSP_NAME value of the last record is displayed. Why it is like that - the message is displayed before the last record check? and what would be the right way to loop through the records?

循环后,则显示最后一条记录的 DSP_NAME 值。为什么会这样 - 在最后一次记录检查之前显示消息?什么是循环记录的正确方法?

回答by GriffeyDog

Your loop is correct. I suspect the last message is showing up in the status bar at the bottom of the form instead of as a popup window.

你的循环是正确的。我怀疑最后一条消息显示在表单底部的状态栏中,而不是显示在弹出窗口中。

回答by Ameer Usman

To get a pop up window use the same line twice :

要获得弹出窗口,请使用同一行两次:

MESSAGE(:MY_BLOCK.DSP_NAME);

MESSAGE(:MY_BLOCK.DSP_NAME);

You'll get it this way.

你会通过这种方式得到它。