diff --git a/PCHW/pchw.sql b/PCHW/pchw.sql index e03ea02fd..08e7d184f 100644 --- a/PCHW/pchw.sql +++ b/PCHW/pchw.sql @@ -1542,22 +1542,32 @@ END; / --Klant specifieke view voor het tonen van het totaal aantal korting per onderwerp over 1 maand -CREATE OR REPLACE VIEW pchw_v_totaal_korting_ond -AS +CREATE OR REPLACE VIEW PCHW.PCHW_V_TOTAAL_KORTING_OND +( + INS_DISCIPLINE_OMSCHRIJVING, + ONDERWERP, + TOTAAL +) +AS SELECT ins_discipline_omschrijving, - DECODE ( - UPPER (ins_discipline_omschrijving), - 'COMFORT', 'FTRC', - 'FUNCTIONALITEIT', 'FTRC', - 'TOEGANKELIJKHEID', 'FTRC', - 'REPRESENTATIVITEIT', 'FTRC', - 'VEILIGHEID ' || CHR (38) || ' GEZONDHEID', 'V' || CHR (38) || 'G', - 'WET ' || CHR (38) || ' REGELGEVING', 'W' || CHR (38) || 'R', - 'Dienst') - onderwerp, totaal - FROM pchx_v_monitoring m, mld_discipline d, mld_melding - where m.discipline_key = d.ins_discipline_key - AND totaal is not null + DECODE ( + UPPER (ins_discipline_omschrijving), + 'COMFORT', 'FTRC', + 'FUNCTIONALITEIT', 'FTRC', + 'TOEGANKELIJKHEID', 'FTRC', + 'REPRESENTATIVITEIT', 'FTRC', + 'VEILIGHEID ' || CHR (38) || ' GEZONDHEID', 'V' + || CHR (38) + || 'G', + 'WET ' || CHR (38) || ' REGELGEVING', 'W' || CHR (38) || 'R', + 'Dienst') + onderwerp, + totaal + FROM pchx_v_monitoring m, mld_discipline d, mld_melding a + WHERE m.discipline_key = d.ins_discipline_key + AND m.melding_key = a.mld_melding_key + AND totaal IS NOT NULL + AND totaal !=0 AND mld_melding_datum > ADD_MONTHS (SYSDATE, -1);