CREATE PROCEDURE "dba"."pv_korrigeeri_koik"( in a_par char(20),in a_id1 integer, in a_s1 char(100) )
BEGIN
  case a_par
    when 'kor_kontod' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."konto"=a_s1 where "gl_selectall"."id1" is not null
    when 'kor_deebet' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."deebet"=a_s1 where "gl_selectall"."id1" is not null
    when 'kor_kreedit' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."kreedit"=a_s1 where "gl_selectall"."id1" is not null
    when 'kor_meetmed' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."meetnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_kuluobjektid' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."kulnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_tegevusalad' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."talnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_kululiigid' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."artnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_tululiigid' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."tulnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_projektid' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."objectnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_osakonnad' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."osaknr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_subjektid' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."subjectnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_tegevussuunad' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."suundnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_taotlused' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."taotnr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_allikad' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."alliknr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_rahavood' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."ravonr"=a_id1 where "gl_selectall"."id1" is not null
    when 'kor_tunnus' then
      update "pv_kanne" left outer join "gl_selectall" on "pv_kanne"."id"="gl_selectall"."id1"
        set "pv_kanne"."tunnus"=a_s1 where "gl_selectall"."id1" is not null
  end case;
END