1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26:
update tbl_matrix_intermediate_result set (str_gewertet) = (select gewertete_ba from ( with w as (select cnt_tbl_matrix_intermediate pk, lng_baumart, str_ba_lang, str_ba_kat, int_prozent, str_gewertet, str_lrt_class from tbl_matrix_intermediate_result where str_ba_kat in ('H', 'N', 'B', 'P') and lng_gebiet = :p_cnt_gebiet and str_lrt_class = :p_str_lrt and int_wg = :p_wg and int_be = :p_be and flag not in (1,2,3,4,5,6,7,8,9,10) and eval_type = 1 ) (select pk, str_ba_lang, prozent, lng_baumart, psumme, case when lng_baumart = 33 and str_gewertet = 'Ja' and prozent is not null and (select count(*) from w where w.lng_baumart in (28,31) and w.int_prozent is not null) = 0 then 'Ja' when lng_baumart = 53 and str_gewertet = 'Ja' and prozent is not null and (select count(*) from w where w.lng_baumart in (28,29,30,31,32,33) and w.int_prozent is not null) = 0 then 'Ja' when lng_baumart = 54 and str_gewertet = 'Ja' and prozent is not null and (select count(*) from w where w.lng_baumart in (13,14,15) and w.int_prozent is not null) = 0 then 'Ja' when lng_baumart = 72 and str_gewertet = 'Ja' and prozent is not null and (select count(*) from w where w.lng_baumart in (22,23,25,26,27) and w.int_prozent is not null) = 0 then 'Ja' when lng_baumart = 74 and str_gewertet = 'Ja' and prozent is not null and (select count(*) from w where w.lng_baumart in (5,6) and w.int_prozent is not null) = 0 then 'Ja' when lng_baumart = 79 and str_gewertet = 'Ja' and prozent is not null and (select count(*) from w where w.lng_baumart in (28,29,30,31,32) and w.int_prozent is not null) = 0 then 'Ja' when lng_baumart not in (33,53,54,72,74,79) and prozent is not null and str_gewertet = 'Ja' then 'Ja' else 'Nein' end as gewertete_ba from (select pk, lng_baumart, str_ba_lang, str_ba_kat ba_kat, str_gewertet, int_prozent prozent, sum(int_prozent) over (partition by str_lrt_class) psumme from w)))z) where cnt_matrix_intermediate_result = z.pk