Newer
Older
-- DROP FUNCTION schema_xyz.is_hi_date_neu2_pg(int8, date);
CREATE OR REPLACE FUNCTION schema_xyz.is_hi_date_neu2_pg(my_uid bigint, my_date date)
RETURNS bigint
LANGUAGE plpgsql
AS $function$
#variable_conflict use_variable
DECLARE
ergebnis bigint;
BEGIN
select count(*) into STRICT ergebnis
from schema_xyz.relation
where uid_1=my_uid and uid_0=0 and type in (0,1) and FIRST_DATE<=my_date and last_date>=my_date;
if ergebnis >0 then ergebnis:=1;
else ergebnis:=0;
end if;
RETURN ergebnis;
end;
$function$
;