CREATE FUNCTION "DBA"."get_skoop_kood"( in a_kood char(16) )
RETURNS INTEGER
BEGIN
  declare ll_skoop integer;
  if length(trim(a_kood))>0 then
    select first skoobid.skoop into ll_skoop from skoobid where skoobid.kood=a_kood
  end if;
  if ll_skoop is null then
    set ll_skoop=0
  end if;
  return ll_skoop;
END