Search code examples
stringoracle-databaseoracle11g

literal does not match format string oracle 11g


exec altacliente('tor','156','mat','tor','409911',908,'295',(TO_DATE('2003/05/03','DD-MON-YYYY')),'Itau','2312312','peru','lima','lima',(TO_DATE('2016/10/27','DD-MON-YYYY')));

Procedure:

create or replace PROCEDURE           "ALTACLIENTE" (nusuario in varchar2, nclave in varchar2, nnombre in varchar2, napellido in varchar2,ntarjeta in varchar2,nncalle in number,

codseguridad in varchar2,fechavenc in date, empresatarj in varchar2,ntelefono in varchar2, pais in varchar2, localidad in varchar2, calle in varchar2, fechahoy in date);

Informe de error - ORA-01861: literal does not match format string ORA-06512: at line 1 01861. 00000 - "literal does not match format string" *Cause: Literals in the input must be the same length as literals in the format string (with the exception of leading whitespace). If the "FX" modifier has been toggled on, the literal must match exactly, with no extra whitespace. *Action: Correct the format string to match the literal.


Solution

  • Obviously the format

    TO_DATE('2003/05/03','DD-MON-YYYY')
    

    does not match.

    As already stated by mathguy MON means "Abbreviated name of month", not month number.

    Apart from that the format should be one of the following (since I don't know whether you mean "3rd of May" or "5th of March")

    TO_DATE('2003/05/03','YYYY/MM/DD')
    TO_DATE('2003/05/03','YYYY/DD/MM')
    TO_DATE('03-05-2003','DD-MM-YYYY')
    TO_DATE('05-03-2003','DD-MM-YYYY')
    TO_DATE('03-MAY-2003','DD-MON-YYYY')
    TO_DATE('05-APR-2003','DD-MON-YYYY')