4 Replies Latest reply: Apr 1, 2014 2:56 AM by BluShadow RSS

    help1

    1043556

      hi all

      i want to call private procedures of another package in my package  how can i call
      pls advice.

        • 1. Re: help1
          BluShadow

          If they're private procedures, then you won't be able to call them from another package.... because they're 'private' to the package they are defined in.

          If you need to call them you will have to make them public by changing the package specification for that package to include them (presuming you are permitted to do that).

          • 2. Re: help1
            BluShadow

            p.s. "help1" is not a very good subject line for an issue on the forums.  It doesn't help people identify easily if it's an issue they will be able to help with or not, so wastes their time having to look at the actual issue content.

             

            Please read: Re: 2. How do I ask a question on the forums?

            • 3. Re: help1
              1043556

              hi in the specification  i have SP_CHEQUEVALIDATION procedure in the body i have CHECK_FOR_CHEQUE_ALREADY_PAID private proc
              now i want to call this proc in my pkg how can i call pls help.

              CREATE OR REPLACE PACKAGE PKG_CHEQUEVALIDATION IS
                    

                     PROCEDURE SP_CHEQUEVALIDATION (V_ENTITY_NUM IN NUMBER,V_INTACNUM                IN NUMBER,
                                                   V_FROMCHQNUM              IN NUMBER,
                                                   V_UPTOCHQNUM              IN NUMBER,
                                                   V_CHQDATE                 IN VARCHAR2,
                                                   V_RETURNVALUE             OUT NUMBER,
                                                   V_ERRORMSG                OUT VARCHAR2,
                                                   V_FROM_CHEQUE_ISSUE_ENTRY IN VARCHAR2 DEFAULT '0');
                END PKG_CHEQUEVALIDATION;

              /

              CREATE OR REPLACE PACKAGE BODY PKG_CHEQUEVALIDATION IS
                     W_INTACNUM                NUMBER(14);
                     W_FROMCHQNUM              NUMBER(15);
                     W_UPTOCHQNUM              NUMBER(15);
                     W_CHQDATE                 DATE;
                     W_RETURNVALUE             NUMBER(2);
                     W_ERRORMSG                VARCHAR2(100);
                     W_ERROR_STATUS            NUMBER(1);
                     W_CURR_DATE               DATE;
                     W_INST_TYPE               VARCHAR2(3);
                     W_FROM_CHEQUE_ISSUE_ENTRY VARCHAR2(1);
                     EXP_RETSTATUS EXCEPTION;
                     W_DUMMY          NUMBER(2);
                     W_MAX_STALE_DATE DATE;
                     --MANI TAN 03-11-2011 BEG
                     W_INST_TYPE1               VARCHAR2(3);
                     W_ISSUE_DATE               DATE;
                     --MANI TAN 03-11-2011 END
                     PROCEDURE GET_INST_TYPE IS
                     BEGIN
                          SELECT R.RAPARAM_CHQ_INSTR_TYPE
                          INTO   W_INST_TYPE
                          FROM   RAPARAM R,ACNTS A
                           WHERE ACNTS_ENTITY_NUM = PKG_ENTITY.FN_GET_ENTITY_CODE AND   A.ACNTS_INTERNAL_ACNUM = W_INTACNUM AND
                                 A.ACNTS_AC_TYPE = R.RAPARAM_AC_TYPE;
              --MANI TAN 03-11-2011 BEG ---CHKING FOR ACTUAL CHKBK TYPE BY PASSING INTERNAL A/C NO FROM LEAF NO & TO LEAF NO
                          BEGIN
                             SELECT CB.CBISS_ISSUE_DATE ,CB.CBISS_CBTYPE_CODE INTO W_ISSUE_DATE,W_INST_TYPE1 FROM CBISS CB WHERE CB.CBISS_ENTITY_NUM=PKG_ENTITY.FN_GET_ENTITY_CODE
                                  AND CB.CBISS_CLIENT_ACNUM= W_INTACNUM AND CB.CBISS_FROM_LEAF_NUM <= W_FROMCHQNUM AND CB.CBISS_UPTO_LEAF_NUM >= W_UPTOCHQNUM
                                  AND CB.CBISS_AUTH_ON IS NOT NULL; --s.sathish kumar/27-12-2011/auth_on condition added.
                          EXCEPTION
                            WHEN NO_DATA_FOUND THEN
                              NULL;
                          END;
                        IF  W_ISSUE_DATE < '17-OCT-2011' THEN
                           IF W_INST_TYPE1 = 'COM' THEN
                               W_INST_TYPE :=  W_INST_TYPE1;
                           ELSE
                                W_INST_TYPE := ' ';
                           END IF;
                        END IF;
                    EXCEPTION
                          WHEN NO_DATA_FOUND THEN
                           BEGIN
                             SELECT CB.CBISS_ISSUE_DATE ,CB.CBISS_CBTYPE_CODE INTO W_ISSUE_DATE,W_INST_TYPE1 FROM CBISS CB WHERE CB.CBISS_ENTITY_NUM=PKG_ENTITY.FN_GET_ENTITY_CODE
                                  AND CB.CBISS_CLIENT_ACNUM= W_INTACNUM AND CB.CBISS_FROM_LEAF_NUM <= W_FROMCHQNUM AND CB.CBISS_UPTO_LEAF_NUM >= W_UPTOCHQNUM ;
                         IF  W_ISSUE_DATE < '17-OCT-2011' THEN
                           IF W_INST_TYPE1 = 'COM'  THEN
                               W_INST_TYPE :=  W_INST_TYPE1;
                           ELSE
                                W_INST_TYPE := ' ';
                           END IF;
                         END IF;
                  --MANI TAN 03-11-2011 END
                          EXCEPTION
                            WHEN NO_DATA_FOUND THEN
                               W_INST_TYPE := ' ';
                        END;

                     END GET_INST_TYPE;

                     PROCEDURE CHECK_FOR_CHEQUE_ALREADY_PAID IS
                     BEGIN
                          <<CHQUSG>>
                          BEGIN
                               SELECT COUNT(1)
                               INTO   W_DUMMY
                               FROM   CHQUSG C
                                WHERE CHQUSG_ENTITY_NUM = PKG_ENTITY.FN_GET_ENTITY_CODE AND   C.CHQUSG_INTERNAL_AC_NUM = W_INTACNUM AND
                                      C.CHQUSG_CHQ_NUM BETWEEN W_FROMCHQNUM AND
                                      W_UPTOCHQNUM;
                               IF W_DUMMY > 0 THEN
                                    W_RETURNVALUE := 2;
                               END IF;
                          END CHQUSG;
                     END CHECK_FOR_CHEQUE_ALREADY_PAID;
              PROCEDURE SP_CHEQUEVALIDATION(V_ENTITY_NUM IN NUMBER,V_INTACNUM                IN NUMBER,
                                                   V_FROMCHQNUM              IN NUMBER,
                                                   V_UPTOCHQNUM              IN NUMBER,
                                                   V_CHQDATE                 IN VARCHAR2,
                                                   V_RETURNVALUE             OUT NUMBER,
                                                   V_ERRORMSG                OUT VARCHAR2,
                                                   V_FROM_CHEQUE_ISSUE_ENTRY IN VARCHAR2 DEFAULT '0') IS
                     BEGIN
                --ENTITY CODE COMMONLY ADDED - 06-11-2009  - BEG
                         PKG_ENTITY.SP_SET_ENTITY_CODE(V_ENTITY_NUM);
                --ENTITY CODE COMMONLY ADDED - 06-11-2009  - END

                          INIT_PARA;
                          W_INTACNUM   := V_INTACNUM;
                          W_FROMCHQNUM := V_FROMCHQNUM;
                          W_UPTOCHQNUM := V_UPTOCHQNUM;

                          IF TRIM(V_CHQDATE) IS NULL THEN
                               W_CHQDATE := NULL;
                          ELSE
                               W_CHQDATE := TO_DATE(V_CHQDATE,
                                                    'DD-MM-YYYY');
                          END IF;

                          W_FROM_CHEQUE_ISSUE_ENTRY := V_FROM_CHEQUE_ISSUE_ENTRY;

                          <<CHQVALIDATION>>
                          BEGIN
                               CHECK_INPUT_VALUE;
                               IF W_ERROR_STATUS = 0 THEN
                                    PROCESS_FOR_CHQUEUE_VALIDATION;
                               END IF;
                          EXCEPTION
                               WHEN EXP_RETSTATUS THEN
                                    V_RETURNVALUE := W_RETURNVALUE;
                                    W_ERRORMSG    := W_ERRORMSG;
                               WHEN OTHERS THEN
                                    W_RETURNVALUE := 99;
                                    --                    W_ERRORMSG    := 'Error In cheque Validation';
                                    W_ERRORMSG := SUBSTR(SQLERRM,
                                                         1,
                                                         99);
                          END CHQVALIDATION;

                          FORM_OUT_ERROR_MESSAGE;
                          V_RETURNVALUE := W_RETURNVALUE;
                          V_ERRORMSG    := W_ERRORMSG;
                     END SP_CHEQUEVALIDATION;
                BEGIN
                     NULL;
                END PKG_CHEQUEVALIDATION;

              • 4. Re: help1
                BluShadow

                You'll need to declare CHECK_FOR_CHEQUE_ALREADY_PAID in the package specification if you want it to be public and called from another package/procedure outside of this package.

                If you want to call it from within the same package, you just call it like you would any procedure, as that package can see it's own private procedures.