Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Invalid number of arguments
> -----Original Message-----
> From: Roland.Skoldblom_at_ica.se [mailto:Roland.Skoldblom_at_ica.se]
>
> I have a procedur, and when i compile it I get the erro rmessage
> "Invalid number of arguments in call..."
>
> It stops at the line:
>
> vDELIVERY_STOP_DATE:= lpad(nvl(recCursor.DELIVERY_STOP_DATE,0),8,'0');
>
> The datatype declaration in pl/sql is varchar2 for the field
> but in the database it is datatype DATE for that corresponding field.
If I understand you correctly, vDELIVERY_STOP_DATE is type VARCHAR2 but recCursor.DELIVERY_STOP_DATE is type DATE? To format dates you should use the to_char function. Look it up in a manual. Here's an example:
SQL> set serveroutput on
SQL> declare
2 x varchar2 (8) ; 3 y date ; 4 null_date constant varchar2 (8) := rpad ('0', 8, '0') ; 5 begin 6 y := to_date ('19670528', 'YYYYMMDD') ; 7 x := nvl (to_char (y, 'YYYYMMDD'), null_date) ; 8 dbms_output.put_line ('x is <' || x || '>') ; 9 y := null ; 10 x := nvl (to_char (y, 'YYYYMMDD'), null_date) ; 11 dbms_output.put_line ('x is <' || x || '>') ; 12 end ; 13 /
PL/SQL procedure successfully completed. Received on Thu May 10 2001 - 11:28:42 CDT