CREATE FUNCTION "DBA"."get_u_talkood"( in a_skoop integer default 0)
returns char(16)
begin
  declare ls_return char(16);
  if a_skoop > 0 then
    select skoobid.u_talkood into ls_return from skoobid where skoobid.skoop = a_skoop
  end if;
  if ls_return is null or Length(Trim(ls_return)) = 0 then
    select tm_rmpt.u_talkood into ls_return from tm_rmpt where tm_rmpt."id" = 1
  end if;
  if ls_return is null then
    set ls_return = ''
  end if;
  return(ls_return)
end