CREATE FUNCTION "DBA"."getid_ea_col_def_jrknr"()
returns integer
begin
  declare li_return integer;
  if li_return is null or li_return < 1 then
    set li_return=1;
    while exists(select 1 from ea_col_def where "jrknr" = li_return) loop
      set li_return=li_return+1
    end loop
  end if;
  return(li_return)
end