Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Executing @NamedStoredProcedureQuery fails with PLS-00306: wrong number or types of arguments in cal

ian_yNov 25 2019 — edited Nov 25 2019

Stub Stored Procedure:

create or replace PACKAGE BODY CAB_UTILS AS

  Procedure findUPRNForAddress(pAddressID IN INTEGER, pMPANCore IN INTEGER, pUPRN OUT INTEGER)

  IS

    l_UPRN      integer := 0;

  BEGIN

    pUPRN := 1;

  EXCEPTION

    WHEN NO_DATA_FOUND THEN

        pUPRN := 1;

    WHEN OTHERS THEN

        RAISE;

  END findUPRNForAddress;

END CAB_UTILS ;

Entity definition entry:

@NamedStoredProcedureQuery( name="CabBlpu.findUPRNForAddress",

                                procedureName="CAB_UTILS.findUPRNForAddress",

                                parameters={@StoredProcedureParameter(name="addressId", type = Integer.class, mode=ParameterMode.IN, queryParameter="pAddressId"),

                                            @StoredProcedureParameter(name="mpanCore", type = Integer.class, mode=ParameterMode.IN, queryParameter="pMPANCore"),

                                            @StoredProcedureParameter(name="uprn", type = Integer.class, mode=ParameterMode.OUT, queryParameter="pUPRN")}

                                )

Bean invoking the StoredProc:

    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

    public List<CabBlpu> getCabBlpuData( String pUprn, String pAddressId, String pMpanCore) {

      

       // parameters will be used in the order in which they are provided

        long theUprn;

       

        if (pUprn.isEmpty()) {

            // We need to get the UPRN from the MPAN or AddressId in ADQM;

            StoredProcedureQuery getUPRN = em.createNamedStoredProcedureQuery("CabBlpu.findUPRNForAddress");

            getUPRN.setParameter("pAddressId", pAddressId.isEmpty() ? 0 : Integer.parseInt(pAddressId));

            getUPRN.setParameter("pMPANCore", pMpanCore.isEmpty() ? 0 : Integer.parseInt(pMpanCore));

            getUPRN.execute();

            theUprn = (Integer) getUPRN.getOutputParameterValue("pUPRN");

        } else {

            theUprn = Long.parseLong(pUprn);

        }

    return getCabBlpuFindByUPRN(BigDecimal.valueOf(theUprn));

    }

The failure occurs at the following line:

   getUPRN.execute();

I'm new to using JPA so appreciate any pointers as to where the problem lies.

Comments
Post Details
Added on Nov 25 2019
0 comments
464 views