Skip to Main Content

SQL & PL/SQL

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Getting ORA-01861: literal does not match format string error in procedure OUT parameter

AB115Oct 3 2017 — edited Oct 12 2017

Hi All,

we have a below procedure and when we run it and try to get date as out parameter, we are getting "ORA-01861: literal does not match format string" error,

CREATE OR REPLACE PROCEDURE test_proc ( p_date   OUT DATE )

    AS

BEGIN

    SELECT

        TO_CHAR(

            SYSDATE,

            'yyyy-mm-dd'

        )

    INTO

        p_date

    FROM

        dual;

    dbms_output.put_line('Date: ' || p_date);

/*EXCEPTION

    WHEN OTHERS THEN

        p_date := NULL;*/

END;

Getting below error,

DECLARE

    p_date   DATE;

BEGIN

    test_proc(p_date);

END;

Error report -

ORA-01861: literal does not match format string

ORA-06512: at "XXCCT.TEST_PROC", line 4

ORA-06512: at line 4

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.

Please suggest.

Thanks.

This post has been answered by John Thorton on Oct 3 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 9 2017
Added on Oct 3 2017
67 comments
8,460 views