diff --git a/WOSA/wosa.sql b/WOSA/wosa.sql new file mode 100644 index 000000000..c0ad6271b --- /dev/null +++ b/WOSA/wosa.sql @@ -0,0 +1,185 @@ +-- +-- $Id$ +-- +-- Script containing customer specific db-configuration for WOSA. +DEFINE thisfile = 'WOSA.SQL' +DEFINE dbuser = '^WOSA' + +SET ECHO ON +SET DEFINE ON +COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT; +COLUMN fcltcusttxt NEW_VALUE fcltcusttxt NOPRINT; +WHENEVER SQLERROR CONTINUE; +SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL; +SPOOL &fcltlogfile +WHENEVER SQLERROR EXIT; +SELECT adm.checkscriptcust('&dbuser') AS fcltcusttxt FROM DUAL; +WHENEVER SQLERROR CONTINUE; +--------------------------------------- +PROMPT &fcltcusttxt +--------------------------------------- +SET DEFINE OFF + +------ payload begin ------ + +CREATE OR REPLACE VIEW wosa_v_rap_tobiasax_groep +( + Beschrijving_cluster, + SOH, + Projectgroep, + SOH_Omschrijving, + Kostensoort, + Actiecode, + Actiecode_omschrijving, + PMC, + TO_nr, + Calc_nr, + Clustercode, + Cluster_omschrijving, + Aantal, + Eenheid, + Technische_omschrijving, + Bouwjaar, + Leverancier, + Budgethouder, + Opzichter, + Begroting_bedrag, + Object, + Vastgoedtype +) +AS + SELECT x.Beschrijving_cluster, + x.SOH, + x.Projectgroep, + x.SOH_Omschrijving, + x.Kostensoort, + x.Actiecode, + x.Actiecode_omschrijving, + x.PMC, + x.TO_nr, + x.Calc_nr, + x.Clustercode, + x.Cluster_omschrijving, + x.Aantal, + x.Eenheid, + x.Technische_omschrijving, + x.Bouwjaar, + x.Leverancier, + x.Budgethouder, + x.Opzichter, + SUM (x.Begroting), + x.Object, + x.Vastgoedtype + FROM (SELECT (SELECT alg_onrgoedkenmerk_waarde + FROM alg_onrgoedkenmerk ak, alg_gebouw g + WHERE mt.clustercode = g.alg_gebouw_code + AND ak.alg_onrgoed_niveau = 'G' + AND ak.alg_onrgoed_key = g.alg_gebouw_key + AND ak.alg_kenmerk_key = 1000) + Beschrijving_cluster -- cluster kenmerk + , + DECODE (mt.projectgroep, + '40.1', '20', + '40.2', '35', + '60', '22', + NULL) + SOH, + mt.projectgroep + Projectgroep, + DECODE (mt.projectgroep, + '40.1', 'EXPLOITATIE', + '40.2', 'ENERGIEMAATREGELEN', + '60', 'LEEFBAARHEID', + NULL) + SOH_Omschrijving, + NULL + Kostensoort, + REGEXP_SUBSTR (mt.GROEPRECEPT, + '[^-]+', + 1, + 1) + Actiecode, + REGEXP_SUBSTR (mt.GROEPRECEPT, + '[^-]+', + 1, + 2) + Actiecode_omschrijving, + NULL + PMC, + NULL + TO_nr, + NULL + Calc_nr, + mt.clustercode + Clustercode, + mt.clusternaam + Cluster_omschrijving, + (SELECT alg_onrgoedkenmerk_waarde + FROM alg_onrgoedkenmerk ak, alg_gebouw g + WHERE mt.clustercode = g.alg_gebouw_code + AND ak.alg_onrgoed_niveau = 'G' + AND ak.alg_onrgoed_key = g.alg_gebouw_key + AND ak.alg_kenmerk_key = 4) + Aantal, + 'won' + Eenheid, + REGEXP_SUBSTR (mt.GROEPRECEPT, + '[^-]+', + 1, + 2) + Technische_omschrijving -- zelfde als substr actiecode omschrijving + , + (SELECT alg_onrgoedkenmerk_waarde + FROM alg_onrgoedkenmerk ak, alg_gebouw g + WHERE mt.clustercode = g.alg_gebouw_code + AND ak.alg_onrgoed_niveau = 'G' + AND ak.alg_onrgoed_key = g.alg_gebouw_key + AND ak.alg_kenmerk_key = 5) + Bouwjaar -- cluster kenmerk + , + NULL + Leverancier, + NULL + Budgethouder, + NULL + Opzichter, + mt.begroting + Begroting, + NULL + Object, + 'cluster' + Vastgoedtype + FROM plat_v_rap_mjob_tobiasax mt) x + GROUP BY x.Beschrijving_cluster, + x.SOH, + x.Projectgroep, + x.SOH_Omschrijving, + x.Kostensoort, + x.Actiecode, + x.Actiecode_omschrijving, + x.PMC, + x.TO_nr, + x.Calc_nr, + x.Clustercode, + x.Cluster_omschrijving, + x.Aantal, + x.Eenheid, + x.Technische_omschrijving, + x.Bouwjaar, + x.Leverancier, + x.Budgethouder, + x.Opzichter, + x.Object, + x.Vastgoedtype; + +------ payload end ------ + +SET DEFINE OFF +BEGIN adm.systrackscriptId ('$Id$', 0); END; +/ + +COMMIT; +SET ECHO OFF +SPOOL OFF +SET DEFINE ON +PROMPT Logfile of this upgrade is: &fcltlogfile \ No newline at end of file