CREATE FUNCTION "dba"."get_pr_saldod_konto"( in "a_skoop" integer ) 
returns char(7)
begin
  declare "ls_return" char(7);
  if "a_skoop" > 0 then
    select Trim("skoobid"."yld_saldod_konto") into "ls_return" from "skoobid" where "skoobid"."skoop" = "a_skoop"
  end if;
  if "ls_return" is null or "Length"("ls_return")=0 then
    select Trim("pr_konfm"."yld_saldod_konto") into "ls_return" from "pr_konfm" where "pr_konfm"."id" = 1
  end if;
  if "ls_return" is null then
    set "ls_return" = ''
  end if;
  return("ls_return")
end