oracle select中使用代码块,Oracle Apex:PL / SQL块中的Javascript代码

在pl/sql块中是否可能有javascript代码。

我想在oracle apex页面进程中执行包含javascript代码的pl/sql块。DECLARE

v_count NUMBER;

BEGIN

select count(*) into v_count

from summary

where prd_items = 'Total';

HTP.p ('

HTP.p ( 'alert(''The value of Total for BU is ' ||v_count|| '.\n'

|| 'You have to enter correct values to proceed further \n'');');

HTP.p ('');

END;

我的页面区域中有Submit按钮,这个pl/sql块是页面处理项,在页面提交时执行(Conditional:Submit)。

但我无法弹出警报框。请告知。

谢谢您。

最佳答案:

在pl/sql块中可以有javascript代码吗?

但是,在提交之后传递javascript函数是行不通的,只有将执行点改为after header才行。

或者,如果您只想验证输入的值而不想使用Apex验证,则可以使用Apex_错误包。请尝试此操作。DECLARE

v_count NUMBER;

BEGIN

select prd_items into v_count

from summary

where prd_items = 'Total';

-- I dont really know what you want to

--accomplish with this query but Im pretty sure

--It will not return a number

-- if you want to count the number of prd_items it should be like this

--select COUNT(*)

--into v_count

--from summary

--where prd_items = 'Total';

APEX_ERROR.ADD_ERROR(

p_message => 'The value of Total for BU is '||v_count||'.
'||

'You have to enter correct values to proceed further',

p_display_location => apex_error.c_inline_in_notification

);

END;

编辑:如果要在计数不等于100时显示错误,请执行以下操作:

DECLARE

v_count NUMBER;

BEGIN

Select COUNT(*)

into v_count

from summary

where prd_items = 'Total';

IF v_count != 100 THEN

APEX_ERROR.ADD_ERROR(

p_message => 'The value of Total for BU is '||v_count||'.
'||

'You have to enter correct values to proceed further',

p_display_location => apex_error.c_inline_in_notification

);

END IF;

END;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值