CREATE FUNCTION "DBA"."if_exists_dk_arve"( in a_arvekuup date, in a_arvenr char(20), in a_asutnr integer )
returns integer
begin
  declare li_return integer;
  set li_return=0;
  if exists(select 1 from dk_kanne where arvekuup=a_arvekuup and arvenr=a_arvenr and asutnr=a_asutnr) then
    set li_return=1
  end if;
  return li_return;
end