GEO
GEO

Reputation: 29

How to correct '' PLS-00306: wrong number or types of arguments in call to ''

I want to call a function(ADD_PRICELIST) that gets values in this one:

*the add_pricelist function complied successfully.

CREATE OR REPLACE FUNCTION PRICELIST_DATA(
  CPRIC_DATA_ID CUSTOMERS.CUSTOMERS_ID%TYPE,
  IPRIC_DATA_ID ITEMS.ITEMS_ID%TYPE
)
RETURN NUMBER AS
  L_PRICELIST_DATA_ID NUMBER;
BEGIN
        L_PRICELIST_DATA_ID := ADD_PRICELIST(ROUND(dbms_random.value(0,10),3)); 
      END IF;
  RETURN L_PRICELIST_DATA_ID;    
END PRICELIST_DATA;

Gives me:

PLS-00306: wrong number or types of arguments in call to ADD_PRICELIST

Upvotes: 0

Views: 863

Answers (1)

MT0
MT0

Reputation: 168671

Your ADD_PRICELIST function as the signature:

CREATE OR REPLACE FUNCTION ADD_PRICELIST(
  L_PLIST_CUST_ID CUSTOMERS.CUSTOMERS_ID%TYPE,
  L_PLIST_ITEMS_ID ITEMS.ITEMS_ID%TYPE,
  P_PRICELIST_PRICE NUMBER
) RETURN NUMBER

This takes 3 values and returns 1 value (which, as an aside, will always return NULL).

You are only calling it with a single argument:

L_PRICELIST_DATA_ID := MINI_ERP.ADD_PRICELIST(
  ROUND(dbms_random.value(0,10),3)
); 

Which gives you the error:

PLS-00306: wrong number or types of arguments in call to ADD_PRICELIST

To solve this, you need to pass the other 2 arguments so that the function has all 3 expected arguments.

For example:

L_PRICELIST_DATA_ID := MINI_ERP.ADD_PRICELIST(
  ROUND(dbms_random.value(0,10),3),
  ROUND(dbms_random.value(0,10),3),
  ROUND(dbms_random.value(0,10),3)
); 

Upvotes: 2

Related Questions