Oracle:使用 LOV 选定值执行查询
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21627294/
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
Oracle : Execute Query with LOV selected value
提问by Mosfet
I need to run a query with a value that is selected from a LOV.
我需要使用从 LOV 中选择的值运行查询。
I've got the next setup :
我有下一个设置:
- a block named "MENIU"
- a table named "MENIU" with a column "ID_MENIU".
- a LOV named "LOV_MENIURI"
- a parameter named P_IDMENIU
- a button on the form named "Alegeti Meniul"
- 一个名为“MENIU”的区块
- 一个名为“MENIU”的表,有一列“ID_MENIU”。
- 名为“LOV_MENIURI”的 LOV
- 一个名为 P_IDMENIU 的参数
- 名为“Alegeti Meniul”的表单上的按钮
In order to run a query with the value selected from the LOV I've tried this :
为了使用从 LOV 中选择的值运行查询,我尝试了以下操作:
- LOV return item "ID_MENIU" is set to PARAMETER.P_IDMENIU
- in the pre-query of block MENIU I've assigned the PARAMETER.P_IDMENIU value to MENIU.ID_MENIU
Button "Alegeti Meniul" has the next "when-button-pressed" trigger code :
declare success boolean; begin Enter_Query; success := show_lov('LOV_MENIURI'); Execute_Query; end;
- LOV返回项“ID_MENIU”设置为PARAMETER.P_IDMENIU
- 在块 MENIU 的预查询中,我已将 PARAMETER.P_IDMENIU 值分配给 MENIU.ID_MENIU
按钮“Alegeti Meniul”具有下一个“按下按钮时”触发代码:
declare success boolean; begin Enter_Query; success := show_lov('LOV_MENIURI'); Execute_Query; end;
My problem is that when pressing the button for the first time nothing happens, if I press the button a second time LOV window appears and the query is executed twice.
我的问题是,当第一次按下按钮时什么也没有发生,如果我第二次按下按钮,就会出现 LOV 窗口并且查询执行两次。
A GIF with the outcome:
带有结果的 GIF:
回答by Elias Medeiros
You don't need that enter_query call.
您不需要那个 enter_query 调用。
begin
if show_lov('LOV_MENIURI') then
execute_query;
end if;
end;
When calling the execute_query built-in you'll fire the pre-query trigger, setting the where clause using the value returned by the LOV.
调用内置的 execute_query 时,您将触发预查询触发器,使用 LOV 返回的值设置 where 子句。