create or alter function FN_IS_EMPTY (
    VALOR varchar(1000),
    RETORNO varchar(1000) default '')
returns varchar(1000)
AS
declare variable RET VARCHAR(1000);
begin
    RET = '';
            
    IF( (TRIM(VALOR) = '') OR (VALOR IS NULL) ) THEN
    BEGIN
        RET = RETORNO;
    END
    ELSE
    BEGIN
        RET = TRIM(VALOR);
    END

    RETURN RET;

end