CREATE FUNCTION nvl( numeric, numeric ) RETURNS
varchar AS '
DECLARE
input_value ALIAS FOR $1;
else_value ALIAS FOR $2;
output_value numeric;
BEGIN
select coalesce( input_value, else_value ) into
output_value ;
return output_value ;
END;
' LANGUAGE 'plpgsql' ;
|