CREATE FUNCTION GET_NAME( V_CODE VARCHAR2) RETURN VARCHAR2
AS
NAME VARCHAR2(242);
BEGIN
SELECT DISTINCT FACT_NAME
INTO NAME
FROM TABLEXXX
WHERE FACT_CODE = V_CODE;
RETURN NAME;
END;
Why even defined VARCHA2 with length 242, it still shows this error? Too strange.
String length constraints must be in range (1 .. 32767)
It should look like this:
CREATE FUNCTION GET_NAME( PV_CODE VARCHAR2) RETURN VARCHAR2
AS
LV_NAME VARCHAR2(242);
BEGIN
SELECT DISTINCT NAME
INTO LV_NAME
FROM TABLEXXX
WHERE NAME_CODE = PV_CODE;
RETURN LV_NAME;
END;
/
You should use prefix before each variable because they causing conflicts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With