Oracle APEX如何使用PL / SQL插入/更新提交页面,然后转换到下一页

时间:2015-03-30 09:14:59

标签: oracle oracle-apex

我有一个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

然后我使用提交按钮保存答案,该按钮使用“提交页面”并调用PL / SQL从上面插入/更新动态生成的项目。像这样:

insert into xxpay_360_answers values (apex_application.g_user, APEX_APPLICATION.G_F01(1));    
commit;

我的问题是,当点击提交按钮时,我怎样才能转换到动态生成的项目的下一页(因为我每页只有50个顶点变量)。

提交按钮只有“提交页面”和“转换到页面”的选项,而不是“提交页面然后转换到页面”。

有没有办法通过PL / SQL过渡作为提交代码的一部分?或者是否有一个事件可以在页面提交后转换?

此外,这是如何处理错误的,并且好的“已保存”飞过该顶点?

2 个答案:

答案 0 :(得分:6)

您需要在后处理区域创建一个分支:

enter image description here

然后您需要设置为分支点:在处理后提交(计算,验证和处理后),分支类型为:分支到页面

enter image description here

然后指定您要去的页码:

enter image description here

最后,只有在按下一个特定按钮并且一个特定条件的计算结果为true时,才能设置要触发的分支:

enter image description here

我认为这可以满足您的需求。

但是如果你想用PL / SQL做,你可以这样做:

将页面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;

或者您可以使用APEX_UTIL.REDIRECT_URL程序。

答案 1 :(得分:1)

如果您使用的是APEX 4.2,请参阅here.

中的APEX_UTIL参考

您可以使用:

apex_util.redirect_url(
 p_url => 'type your url here' 
);

这有效地调用了owa_util。 redirect_url并自动调用apex_application.stop_apex_engine。