I hope to be clear on this issue, I will define it in a generic way but I think it's enough
1) I create a FUNCTION any that returns a VARCHAR, does not matter much what is returned
2) I create a VIEW that uses this FUNCTION
Result: The size of the field that uses FUNCTION in VIEW is as VARCHAR (4000)
Question: Is there any way in FUNCTION that I can specify the return size?
Sample Codes:
create or replace FUNCTION EXEMPLO ( pX IN VARCHAR2)
RETURN VARCHAR2 IS
vSAIDA VARCHAR2(6);
BEGIN
--FAZ ALGUMA COISA E OBTEM VSAIDA;
END IF;
RETURN vSAIDA;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN ' ';
END;
CREATE OR REPLACE VIEW V_EXEMPLO
AS
SELECT EXEMPLO('1') SAIDA FROM DUAL;