oracle select中使用代码块,Oracle Apex:PL / SQL块中的Javascript代码
在pl/sql块中是否可能有javascript代码。我想在oracle apex页面进程中执行包含javascript代码的pl/sql块。DECLAREv_countNUMBER;BEGINselect count(*) into v_countfrom summarywhere prd_items = 'Total';HTP.p ('');HTP.p ('alert(''The ...
在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;
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)