Oracle APEX 如何使用 PL/SQL 插入/更新提交页面,然后转换到下一页
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29342379/
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 APEX How to submit page with PL/SQL insert/update and then transition to next page
提问by Superdooperhero
I have an Oracle APEX page that collects data via a classic report with apex_item dynamically generated items. Something like this:
我有一个 Oracle APEX 页面,它通过带有 apex_item 动态生成项目的经典报告收集数据。像这样的东西:
select apex_item.radiogroup(qt.save_position, 1, qt.answer, null, null, null, null) col01
from xxpay_360_questions qt
where qt.questionnaire_id = 21
I then save the answers using a submit button that uses "Submit Page" and calls PL/SQL to insert/update the dynamically generated items from above. Something like this:
然后我使用提交按钮保存答案,该按钮使用“提交页面”并调用 PL/SQL 来插入/更新从上面动态生成的项目。像这样的东西:
insert into xxpay_360_answers values (apex_application.g_user, APEX_APPLICATION.G_F01(1));
commit;
My question is how can I also do a transition to the next page of dynamically generated items (since I only have 50 apex variables to play with per page) when the submit button is clicked.
我的问题是,当单击提交按钮时,我如何还可以转换到下一页动态生成的项目(因为我每页只有 50 个顶点变量可供使用)。
The submit button only has options for "Submit Page" and "Transition to Page" and not "Submit Page and then Transition to Page".
提交按钮只有“提交页面”和“转换到页面”选项,没有“提交页面然后转换到页面”选项。
Is there a way of transitioning via PL/SQL as part of the submit code? Or is there an event that can transition after the page has been submitted?
有没有办法通过 PL/SQL 作为提交代码的一部分进行转换?或者有没有可以在页面提交后转换的事件?
Also how does this work with errors and the nice "Saved" fly over that apex has?
此外,这如何处理错误以及漂亮的“已保存”飞越该顶点?
回答by Typo
You need to create a Branch, on the after processing region:
您需要在后处理区域上创建一个分支:
Then you need to set as branch point: On Submit After Processing (After Computation, Validation and Processing)and the branch type as: Branch to page
然后需要设置为分支点:On Submit After Processing(After Computation, Validation and Processing),分支类型为:Branch to page
Then specify the page number where your going to:
然后指定您要去的页码:
And finally you can set the branch to be fired only if one particular button is pressed and if one particular condition evaluates to true:
最后,您可以将分支设置为仅在按下一个特定按钮并且某个特定条件评估为真时触发:
I think that would cover your needs.
我认为这将满足您的需求。
But if you want to do it with PL/SQL you could do something like this:
但是如果你想用 PL/SQL 来做,你可以做这样的事情:
Replace the page ID with the actual page Id to which you want to redirect the user.
将页面 ID 替换为您要将用户重定向到的实际页面 ID。
BEGIN
IF(CONDITION)THEN
htp.init;
owa_util.redirect_url('f?p=&APP_ID.:10:&APP_SESSION.'); /*Replace 10 with actual Page Number*/
apex_application.stop_apex_engine;
ELSE
htp.init;
owa_util.redirect_url('f?p=&APP_ID.:20:&APP_SESSION.'); /*Replace 20 with actual Page Number*/
apex_application.stop_apex_engine;
END IF;
END;
Or you could use the APEX_UTIL.REDIRECT_URLprocedure.
或者您可以使用APEX_UTIL.REDIRECT_URL过程。
回答by Dush
if you are using APEX 4.2 refer the APEX_UTIL reference from here.
如果您使用的是 APEX 4.2,请参考此处的 APEX_UTIL 参考。
You can use:
您可以使用:
apex_util.redirect_url(
p_url => 'type your url here'
);
This effectively calls in the owa_util. redirect_url and automatically calls apex_application.stop_apex_engine.
这有效地调用了 owa_util。redirect_url 并自动调用 apex_application.stop_apex_engine。