2020-02-21 08:54:57 +07:00
|
|
|
-- IDEMPIERE-4178 Replace NVL with Coalesce
|
|
|
|
CREATE or REPLACE FUNCTION nvl (anyelement, anyelement ) RETURNS anyelement
|
|
|
|
LANGUAGE plpgsql
|
|
|
|
IMMUTABLE
|
|
|
|
AS $function$
|
|
|
|
BEGIN
|
|
|
|
RETURN coalesce($1, $2);
|
|
|
|
END;
|
|
|
|
$function$
|
|
|
|
;
|
|
|
|
|
|
|
|
CREATE or REPLACE FUNCTION nvl (numeric, integer ) RETURNS numeric
|
|
|
|
LANGUAGE plpgsql
|
|
|
|
IMMUTABLE
|
|
|
|
AS $function$
|
|
|
|
BEGIN
|
|
|
|
RETURN nvl($1, $2::numeric);
|
|
|
|
END;
|
|
|
|
$function$
|
|
|
|
;
|
|
|
|
|
|
|
|
CREATE or REPLACE FUNCTION nvl (integer, numeric ) RETURNS numeric
|
|
|
|
LANGUAGE plpgsql
|
|
|
|
IMMUTABLE
|
|
|
|
AS $function$
|
|
|
|
BEGIN
|
|
|
|
RETURN nvl($1::numeric, $2);
|
|
|
|
END;
|
|
|
|
$function$
|
|
|
|
;
|
2022-11-23 15:22:52 +07:00
|
|
|
|
|
|
|
CREATE or REPLACE FUNCTION nvl (text, text ) RETURNS text
|
|
|
|
LANGUAGE plpgsql
|
|
|
|
IMMUTABLE
|
|
|
|
AS $function$
|
|
|
|
BEGIN
|
|
|
|
RETURN COALESCE($1, $2);
|
|
|
|
END;
|
|
|
|
$function$
|
|
|
|
;
|