4 Replies Latest reply: Jan 2, 2013 1:27 AM by 959687 RSS

    How to debug the function separately which is added in the package

    959687
      Hi Friends, I want to know how to debug the function separately, by taking it from package,. and i dont no where to add begin and end. and dont no how to give input to the function. ANd how to find the error which is detected from production, so i want to find from which statement its failing. So please guide me to proceed further. thanks in advance.
        • 1. Re: How to debug the function separately which is added in the package
          Manik
          Your question is vague to be answered.
          Assuming you are well versed with anonymous blocks. Try this:

          1) Make declare begin exception end block of that function which you are talking about.
          2) The return value of the function would become as dbms_output.
          3) Make use of DBMS_OUTPUT.PUT_LINE( DBMS_UTILITY.FORMAT_ERROR_BACKTRACE ) for knowing exactly where you are encountering error.

          Check this link for more info on how ot use the step 3:

          http://www.oracle-developer.net/display.php?id=318

          Cheers,
          Manik.
          • 2. Re: How to debug the function separately which is added in the package
            959687
            { FUNCTION fn_get_trail_id (p_incr PLS_INTEGER DEFAULT 1) RETURN PLS_INTEGER IS
            p_trail_id tb_xop_orders_trail.trail_id%TYPE;
            BEGIN
            IF p_incr >= 1 THEN
            SELECT sq_xop_trail_id.NEXTVAL INTO p_trail_id FROM DUAL;
            RETURN p_trail_id;
            ELSIF p_incr = 0 THEN
            SELECT sq_xop_trail_id.CURRVAL INTO p_trail_id FROM DUAL;
            RETURN p_trail_id;
            END IF;
            END;

            -- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
            BEGIN
            ppr_openlog('AQ');

            ppr_request_lock(v_cb_handle, v_cb_lock);
            pr_xop_log_errors('AQ: ==== cb started ('||descr.msg_id||') ====');
            }



            my function is like this, how i can i in clude it in declare statement, and how to assign values for that.. and where i have to include "begin".plz help me
            • 3. Re: How to debug the function separately which is added in the package
              Etbin
              Maybe
              DECLARE
              
                p_incr     pls_integer := 1; /* change the value at will */
                p_trail_id pls_integer;
              
              BEGIN
              
                IF p_incr >= 1 THEN
              
                  SELECT sq_xop_trail_id.NEXTVAL 
                    INTO p_trail_id 
                    FROM DUAL;
              
                ELSIF p_incr = 0 THEN
              
                  SELECT sq_xop_trail_id.CURRVAL 
                    INTO p_trail_id 
                    FROM DUAL;
              
                END IF;
              /*
                RETURN p_trail_id;
              */
                DBMS_OUTPUT.PUT_LINE(p_trail_id); /* just for debugging */
              
              END;
              Regards

              Etbin
              • 4. Re: How to debug the function separately which is added in the package
                959687
                Hi, Thank you very much friend..