如何通过动态操作显示plsql错误消息 [英] How to display a plsql error message with dynamic action

查看:185
本文介绍了如何通过动态操作显示plsql错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个返回单行的plsql,并且我正在通过动态操作执行它,如果没有值,我想通过 APEX_ERROR.ADD_ERROR 显示不同的错误消息. 显然,所有代码都是正确的,但是如果出错,则不会显示任何消息.

I have a plsql that returns a single row and I am executing it by dynamic action, I want to show different error messages by means of APEX_ERROR.ADD_ERROR in case there is no value. Apparently, all the code is correct, but in case of error, it does not show any message.

注意:动态操作是通过按一个键,在客户端条件javascript =//输入键 this.browserEvent.which === 13 不要提交页面.

note: the dynamic action is by pressing a key Condition on the client side javascript = // Enter key this.browserEvent.which === 13 do not submit page.

我不知道这种方法是否错误,您可以找到更好的方法.

        declare
        l_serie number;
        l_codigo number;
        l_product_name varchar2(500);
        l_precio number;
        l_exists number;

        begin

          select count(*)
          into l_exists
          from (
          select a.ID_INGRESO_SERIE,
                 a.CODIGO_PRODUCTO,
                (select PRODUCT_NAME 
                 from   TBL_PRD_DET
                 where  PRODUCT_ID =a.CODIGO_PRODUCTO ) PRODUCTO,
                (select PRICE
                 from   TBL_SALE_PRICE
                 where PRODUCT_ID=a.CODIGO_PRODUCTO
                 and INVETORY_TYPE=1) PRECIO  
          from   TBL_INGRESOS_DET_SERIES a
          where  ID_INGRESO_SERIE =:P58_CODIGO
          and ESTADO_SERIE = 1
          );


          if l_exists > 0 then

            select a.ID_INGRESO_SERIE,
                   a.CODIGO_PRODUCTO,
                   (select PRODUCT_NAME 
                    from   TBL_PRD_DET
                    where  PRODUCT_ID =a.CODIGO_PRODUCTO ) PRODUCTO,
                   (select PRICE
                    from   TBL_SALE_PRICE
                    where PRODUCT_ID=a.CODIGO_PRODUCTO
                    and INVETORY_TYPE=1) PRECIO  
            into   l_serie,l_codigo,l_product_name,l_precio      
            from   TBL_INGRESOS_DET_SERIES a
            where  ID_INGRESO_SERIE =:P58_CODIGO
            and    ESTADO_SERIE = 1;

            APEX_COLLECTION.ADD_MEMBER (
            p_collection_name =>'LISTA_VENTA',
            p_n001            =>l_codigo,--CODIGO
            p_n002            => 1, ---UNIDADES
            p_n003            =>l_precio , ---PRECIO
            p_n004            =>0,   ---DESCUENTO
            p_n005            =>l_serie,---CODIGO SERIE
            p_c001            =>l_product_name,---NOMBRE PRODUCTO
            p_d001            => SYSDATE
            );

          else
            apex_error.add_error (
            p_message => '¡no exit producto!',
            p_display_location => apex_error.c_inline_in_notification);

          end if;
        end;

推荐答案

apex_error包仅与页面处理相关,与动态动作之间不存在交互.

apex_error package is only relevant to page processing, not interactions with dynamic actions.

您需要使用类似的技术来显示消息 https://www.talkapex.com/2018/03/custom -apex-notification-messages/

You'll need to display message using technique like this https://www.talkapex.com/2018/03/custom-apex-notification-messages/

也许使用这里提到的概念 https://community.oracle.com/message/14948411#14948411

Perhaps using concepts mentioned here https://community.oracle.com/message/14948411#14948411

您的过程将在其中设置一个隐藏值,然后使用自定义API进行显示.您是否可以重新使用它取决于您自己.

Where your process would set a hidden value, then be displayed using the custom API. How re-usable you make this is up to you.

这篇关于如何通过动态操作显示plsql错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆