CREATE FUNCTION "DBA"."getid_dk_costreport"()
returns integer
begin
  declare li_return integer;
  select max(id) into li_return from dk_costreport;
  if li_return is null then
    set li_return = 0
  end if;
  return(li_return)
end