Total Pageviews

2020/07/10

[Oracle] PLS-00215: String length constraints must be in range

Problem
When I tried to create a stored procedure package as bellows:

CREATE OR REPLACE PACKAGE PG_TEST_001 AS
    v_last2Month     VARCHAR2 := '';

    PROCEDURE SP_Get_LAST2MONTH(i_dataId IN VARCHAR2,
                                o_last2Month OUT VARCHAR2);

END PG_TEST_001;

/

I got this error message from SQL Developer:
PLS-00215: String length constraints must be in range


How-To
This error message resulted from the missing length in variable declaration, it should be fixed as following:
CREATE OR REPLACE PACKAGE PG_TEST_001 AS
    v_last2Month     VARCHAR2(8) := '';

    PROCEDURE SP_Get_LAST2MONTH(i_dataId IN VARCHAR2,
                                o_last2Month OUT VARCHAR2);

END PG_TEST_001;

/



No comments: