来自Oracle apex中的PLSQL的警报消息

如果要满足某些条件,我想显示来自PLSQL的警报消息。但是它不起作用。

请在单击复选框时检查我在动态操作中编写的PLSQL代码。

declare
var_hire DATE ;
tenure_dt DATE;
i number;
TENURE EXCEPTION;
BEGIN
SELECT HIREDATE INTO var_hire from employee where empno=107;
-- APEX_APPLICATION.G_F01(1);
SELECT var_hire+ INTERVAL '1' YEAR INTO  tenure_dt FROM DUAL;
 IF SYSDATE < to_Date(tenure_dt,'DD-MON-YY') THEN

 /* APEX_ERROR.ADD_ERROR (
p_message  => 'The employee cannot be deleted',p_display_location => apex_error.c_inline_in_notification );*/
apex_application.g_global_notification( 'The employee cannot be deleted');
END IF ;
END  ;

declare
var_hire DATE ;
tenure_dt DATE;
i number;
TENURE EXCEPTION;
BEGIN
SELECT HIREDATE INTO var_hire from employee where empno=107;
-- APEX_APPLICATION.G_F01(1);
SELECT var_hire+ INTERVAL '1' YEAR INTO  tenure_dt FROM DUAL;


    APEX_ERROR.ADD_ERROR (
    p_message  => 'The employee cannot be deleted',p_display_location => apex_error.c_inline_in_notification );



EXCEPTION
WHEN TENURE THEN 
RAISE_APPLICATION_ERROR(-20000,'CANNOT BE DELETED');
END  ;
wyb001 回答:来自Oracle apex中的PLSQL的警报消息

您可以使用您的PL / SQL代码创建Ajax callback process。例如,将Ajax回调过程创建为 MyQuery

declare
var_hire DATE ;
tenure_dt DATE;
i number;
TENURE EXCEPTION;
BEGIN
    SELECT HIREDATE INTO var_hire from employee where empno=107;
    SELECT var_hire+ INTERVAL '1' YEAR INTO  tenure_dt FROM DUAL;
         IF SYSDATE < to_Date(tenure_dt,'DD-MON-YY') THEN
            HTP.P('The employee cannot be deleted');    
         END IF ;
END  ;

然后在javascript code

下方的复选框上创建动态操作(“执行javascript代码”)
apex.server.process('MyQuery',{ },{
      dataType: "text",success: function(pData) {
         if (pData != "") {
            apex.message.alert(pData);
         }
      }
  });
本文链接:https://www.f2er.com/3168520.html

大家都在问