Error: “Wrong number or types or arguments” when passing array to another procedure












0















I want to pass array as arguement to another procedure..Both are in same package..In this below scenario demo array is passed .. Getting error : " PLS-00306 wrong number or types of arguments is displayed " ..



CREATE or REPLACE package WSH_Delivery_Detail_Shipment is

type Result IS VARRAY(8) OF INTEGER;
p_result Result:=Result();

PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String);
PROCEDURE CreateShipmentLines(p_result IN RESULT);

END WSH_Delivery_Detail_Shipment;
/


CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)

IS

CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

type Result IS VARRAY(8) OF INTEGER;
p_result Result:=Result(1,1,1,1,1,1,1,1);

BEGIN

OPEN wddi_cur;

LOOP

.. Some few select queries>>>>

WSH_Delivery_Detail_Shipment.CreateShipmentLines(p_result); // Calling procedure and passing array



END LOOP;
CLOSE wddi_cur;
END CreateShipment;

procedure CreateShipmentLines(p_result IN RESULT)

is

BEGIN

....Some select queries

END CreateShipmentLines;
END WSH_Delivery_Detail_Shipment;
/









share|improve this question





























    0















    I want to pass array as arguement to another procedure..Both are in same package..In this below scenario demo array is passed .. Getting error : " PLS-00306 wrong number or types of arguments is displayed " ..



    CREATE or REPLACE package WSH_Delivery_Detail_Shipment is

    type Result IS VARRAY(8) OF INTEGER;
    p_result Result:=Result();

    PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String);
    PROCEDURE CreateShipmentLines(p_result IN RESULT);

    END WSH_Delivery_Detail_Shipment;
    /


    CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

    PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)

    IS

    CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
    wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

    type Result IS VARRAY(8) OF INTEGER;
    p_result Result:=Result(1,1,1,1,1,1,1,1);

    BEGIN

    OPEN wddi_cur;

    LOOP

    .. Some few select queries>>>>

    WSH_Delivery_Detail_Shipment.CreateShipmentLines(p_result); // Calling procedure and passing array



    END LOOP;
    CLOSE wddi_cur;
    END CreateShipment;

    procedure CreateShipmentLines(p_result IN RESULT)

    is

    BEGIN

    ....Some select queries

    END CreateShipmentLines;
    END WSH_Delivery_Detail_Shipment;
    /









    share|improve this question



























      0












      0








      0








      I want to pass array as arguement to another procedure..Both are in same package..In this below scenario demo array is passed .. Getting error : " PLS-00306 wrong number or types of arguments is displayed " ..



      CREATE or REPLACE package WSH_Delivery_Detail_Shipment is

      type Result IS VARRAY(8) OF INTEGER;
      p_result Result:=Result();

      PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String);
      PROCEDURE CreateShipmentLines(p_result IN RESULT);

      END WSH_Delivery_Detail_Shipment;
      /


      CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

      PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)

      IS

      CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
      wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

      type Result IS VARRAY(8) OF INTEGER;
      p_result Result:=Result(1,1,1,1,1,1,1,1);

      BEGIN

      OPEN wddi_cur;

      LOOP

      .. Some few select queries>>>>

      WSH_Delivery_Detail_Shipment.CreateShipmentLines(p_result); // Calling procedure and passing array



      END LOOP;
      CLOSE wddi_cur;
      END CreateShipment;

      procedure CreateShipmentLines(p_result IN RESULT)

      is

      BEGIN

      ....Some select queries

      END CreateShipmentLines;
      END WSH_Delivery_Detail_Shipment;
      /









      share|improve this question
















      I want to pass array as arguement to another procedure..Both are in same package..In this below scenario demo array is passed .. Getting error : " PLS-00306 wrong number or types of arguments is displayed " ..



      CREATE or REPLACE package WSH_Delivery_Detail_Shipment is

      type Result IS VARRAY(8) OF INTEGER;
      p_result Result:=Result();

      PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String);
      PROCEDURE CreateShipmentLines(p_result IN RESULT);

      END WSH_Delivery_Detail_Shipment;
      /


      CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

      PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)

      IS

      CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
      wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

      type Result IS VARRAY(8) OF INTEGER;
      p_result Result:=Result(1,1,1,1,1,1,1,1);

      BEGIN

      OPEN wddi_cur;

      LOOP

      .. Some few select queries>>>>

      WSH_Delivery_Detail_Shipment.CreateShipmentLines(p_result); // Calling procedure and passing array



      END LOOP;
      CLOSE wddi_cur;
      END CreateShipment;

      procedure CreateShipmentLines(p_result IN RESULT)

      is

      BEGIN

      ....Some select queries

      END CreateShipmentLines;
      END WSH_Delivery_Detail_Shipment;
      /






      oracle plsql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 2 at 14:34









      William Robertson

      8,48632233




      8,48632233










      asked Jan 2 at 13:19









      rahul bhandarirahul bhandari

      33




      33
























          2 Answers
          2






          active

          oldest

          votes


















          3














          You declared two types named Result. CreateShipmentLines expects the first one but you are passing the second one.



          Removing the second declaration (the line starting 'type Result is ...' in CreateShipment) should fix the issue.






          share|improve this answer































            1














            From the documentation:




            A collection type defined in a package specification is incompatible with an identically defined local or standalone collection type.




            Although in your case both the declarations are within the package, the second one is local to the CreateShipment procedure definition, and so is still incompatible with the declaration in the package specification. Although they look the same to you, to the Oracle compiler they are different types.



            So as @WilliamRobertson said, you just need to change your procedure to use the type declared in the specification:



            CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

            PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)
            IS

            CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
            wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

            -- type Result IS VARRAY(8) OF INTEGER; -- remove this
            p_result Result:=Result(1,1,1,1,1,1,1,1); -- now uses type from specification

            BEGIN
            ...


            As a separate issue, the p_result Result:=Result(); in the package specification is also completely separate to the p_result variable declared in that procedure definition. From what you've shown the global p_result is never used, which makes it redundant; but it is also making your package stateful, which you probably didn't intend - and that can lead to unnecessary "ORA-04068: existing state of packages has been discarded" errors later. So you probably want to remove that global variable declaration from the specification. (Of course, if you do use that global variable and it's necessary for your package to have state, then ignore this part...)






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007115%2ferror-wrong-number-or-types-or-arguments-when-passing-array-to-another-proced%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              You declared two types named Result. CreateShipmentLines expects the first one but you are passing the second one.



              Removing the second declaration (the line starting 'type Result is ...' in CreateShipment) should fix the issue.






              share|improve this answer




























                3














                You declared two types named Result. CreateShipmentLines expects the first one but you are passing the second one.



                Removing the second declaration (the line starting 'type Result is ...' in CreateShipment) should fix the issue.






                share|improve this answer


























                  3












                  3








                  3







                  You declared two types named Result. CreateShipmentLines expects the first one but you are passing the second one.



                  Removing the second declaration (the line starting 'type Result is ...' in CreateShipment) should fix the issue.






                  share|improve this answer













                  You declared two types named Result. CreateShipmentLines expects the first one but you are passing the second one.



                  Removing the second declaration (the line starting 'type Result is ...' in CreateShipment) should fix the issue.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 2 at 14:30









                  William RobertsonWilliam Robertson

                  8,48632233




                  8,48632233

























                      1














                      From the documentation:




                      A collection type defined in a package specification is incompatible with an identically defined local or standalone collection type.




                      Although in your case both the declarations are within the package, the second one is local to the CreateShipment procedure definition, and so is still incompatible with the declaration in the package specification. Although they look the same to you, to the Oracle compiler they are different types.



                      So as @WilliamRobertson said, you just need to change your procedure to use the type declared in the specification:



                      CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

                      PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)
                      IS

                      CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
                      wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

                      -- type Result IS VARRAY(8) OF INTEGER; -- remove this
                      p_result Result:=Result(1,1,1,1,1,1,1,1); -- now uses type from specification

                      BEGIN
                      ...


                      As a separate issue, the p_result Result:=Result(); in the package specification is also completely separate to the p_result variable declared in that procedure definition. From what you've shown the global p_result is never used, which makes it redundant; but it is also making your package stateful, which you probably didn't intend - and that can lead to unnecessary "ORA-04068: existing state of packages has been discarded" errors later. So you probably want to remove that global variable declaration from the specification. (Of course, if you do use that global variable and it's necessary for your package to have state, then ignore this part...)






                      share|improve this answer






























                        1














                        From the documentation:




                        A collection type defined in a package specification is incompatible with an identically defined local or standalone collection type.




                        Although in your case both the declarations are within the package, the second one is local to the CreateShipment procedure definition, and so is still incompatible with the declaration in the package specification. Although they look the same to you, to the Oracle compiler they are different types.



                        So as @WilliamRobertson said, you just need to change your procedure to use the type declared in the specification:



                        CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

                        PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)
                        IS

                        CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
                        wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

                        -- type Result IS VARRAY(8) OF INTEGER; -- remove this
                        p_result Result:=Result(1,1,1,1,1,1,1,1); -- now uses type from specification

                        BEGIN
                        ...


                        As a separate issue, the p_result Result:=Result(); in the package specification is also completely separate to the p_result variable declared in that procedure definition. From what you've shown the global p_result is never used, which makes it redundant; but it is also making your package stateful, which you probably didn't intend - and that can lead to unnecessary "ORA-04068: existing state of packages has been discarded" errors later. So you probably want to remove that global variable declaration from the specification. (Of course, if you do use that global variable and it's necessary for your package to have state, then ignore this part...)






                        share|improve this answer




























                          1












                          1








                          1







                          From the documentation:




                          A collection type defined in a package specification is incompatible with an identically defined local or standalone collection type.




                          Although in your case both the declarations are within the package, the second one is local to the CreateShipment procedure definition, and so is still incompatible with the declaration in the package specification. Although they look the same to you, to the Oracle compiler they are different types.



                          So as @WilliamRobertson said, you just need to change your procedure to use the type declared in the specification:



                          CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

                          PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)
                          IS

                          CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
                          wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

                          -- type Result IS VARRAY(8) OF INTEGER; -- remove this
                          p_result Result:=Result(1,1,1,1,1,1,1,1); -- now uses type from specification

                          BEGIN
                          ...


                          As a separate issue, the p_result Result:=Result(); in the package specification is also completely separate to the p_result variable declared in that procedure definition. From what you've shown the global p_result is never used, which makes it redundant; but it is also making your package stateful, which you probably didn't intend - and that can lead to unnecessary "ORA-04068: existing state of packages has been discarded" errors later. So you probably want to remove that global variable declaration from the specification. (Of course, if you do use that global variable and it's necessary for your package to have state, then ignore this part...)






                          share|improve this answer















                          From the documentation:




                          A collection type defined in a package specification is incompatible with an identically defined local or standalone collection type.




                          Although in your case both the declarations are within the package, the second one is local to the CreateShipment procedure definition, and so is still incompatible with the declaration in the package specification. Although they look the same to you, to the Oracle compiler they are different types.



                          So as @WilliamRobertson said, you just need to change your procedure to use the type declared in the specification:



                          CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

                          PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String)
                          IS

                          CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
                          wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

                          -- type Result IS VARRAY(8) OF INTEGER; -- remove this
                          p_result Result:=Result(1,1,1,1,1,1,1,1); -- now uses type from specification

                          BEGIN
                          ...


                          As a separate issue, the p_result Result:=Result(); in the package specification is also completely separate to the p_result variable declared in that procedure definition. From what you've shown the global p_result is never used, which makes it redundant; but it is also making your package stateful, which you probably didn't intend - and that can lead to unnecessary "ORA-04068: existing state of packages has been discarded" errors later. So you probably want to remove that global variable declaration from the specification. (Of course, if you do use that global variable and it's necessary for your package to have state, then ignore this part...)







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jan 2 at 22:31

























                          answered Jan 2 at 18:19









                          Alex PooleAlex Poole

                          133k6107181




                          133k6107181






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007115%2ferror-wrong-number-or-types-or-arguments-when-passing-array-to-another-proced%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Monofisismo

                              Angular Downloading a file using contenturl with Basic Authentication

                              Olmecas