CWTD#15009
svn path=/Customer/trunk/; revision=13736
This commit is contained in:
136
CWTD/Once/CWTD#15009.sql
Normal file
136
CWTD/Once/CWTD#15009.sql
Normal file
@@ -0,0 +1,136 @@
|
||||
SET ECHO ON
|
||||
SPOOL xcwtd#15009.lst
|
||||
PROMPT $Revision: 1 $
|
||||
|
||||
|
||||
/* Formatted on 2008/11/20 10:57 (Formatter Plus v4.8.7) */
|
||||
INSERT INTO ins_discipline
|
||||
(ins_discipline_module, ins_discipline_omschrijving
|
||||
)
|
||||
VALUES ('INS', 'Gebouwobjecten'
|
||||
);
|
||||
|
||||
|
||||
/* Formatted on 2008/11/20 10:57 (Formatter Plus v4.8.7) */
|
||||
INSERT INTO ins_srtgroep
|
||||
(ins_discipline_key, ins_srtgroep_module,
|
||||
ins_srtgroep_omschrijving
|
||||
)
|
||||
VALUES ((SELECT ins_discipline_key
|
||||
FROM ins_discipline
|
||||
WHERE ins_discipline_omschrijving = 'Gebouwobjecten'), 'INS',
|
||||
'Gebouwobjecten'
|
||||
);
|
||||
|
||||
|
||||
/* Formatted on 2008/11/20 10:57 (Formatter Plus v4.8.7) */
|
||||
INSERT INTO ins_srtdeel
|
||||
(ins_srtgroep_key, ins_srtdeel_module,
|
||||
ins_srtdeel_code, ins_srtdeel_omschrijving
|
||||
)
|
||||
VALUES ((SELECT ins_srtgroep_key
|
||||
FROM ins_srtgroep
|
||||
WHERE ins_srtgroep_omschrijving = 'Gebouwobjecten'), 'INS',
|
||||
'GEB', 'Gebouwobjecten'
|
||||
);
|
||||
|
||||
|
||||
/* Formatted on 2008/11/20 10:57 (Formatter Plus v4.8.7) */
|
||||
INSERT INTO alg_verdieping
|
||||
(alg_gebouw_key, alg_verdieping_omschrijving,
|
||||
alg_verdieping_volgnr, alg_verdieping_code)
|
||||
(SELECT alg_gebouw_key, 'BG', 0, '0'
|
||||
FROM alg_gebouw
|
||||
WHERE alg_gebouw_key NOT IN (SELECT alg_gebouw_key
|
||||
FROM alg_v_ruimte_gegevens
|
||||
WHERE alg_ruimte_upper_nr = '000')
|
||||
AND alg_gebouw_key <> 181);
|
||||
|
||||
|
||||
/* Formatted on 2008/11/20 10:57 (Formatter Plus v4.8.7) */
|
||||
INSERT INTO alg_ruimte
|
||||
(alg_verdieping_key, alg_ruimte_nr, alg_srtruimte_key,
|
||||
alg_ruimte_omschrijving)
|
||||
(SELECT v.alg_verdieping_key, '000', 1, 'Onbekend'
|
||||
FROM alg_gebouw g, alg_verdieping v
|
||||
WHERE g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_gebouw_key NOT IN (SELECT alg_gebouw_key
|
||||
FROM alg_v_ruimte_gegevens
|
||||
WHERE alg_ruimte_upper_nr = '000')
|
||||
AND v.alg_gebouw_key <> 181);
|
||||
|
||||
|
||||
/* Formatted on 2008/11/20 10:57 (Formatter Plus v4.8.7) */
|
||||
INSERT INTO ins_deel
|
||||
(ins_deel_module, ins_srtdeel_key, ins_alg_ruimte_key,
|
||||
ins_alg_ruimte_type, ins_deel_aantal, ins_deel_omschrijving)
|
||||
SELECT 'INS', (SELECT ins_srtdeel_key
|
||||
FROM ins_srtdeel
|
||||
WHERE ins_srtdeel_omschrijving = 'Gebouwobjecten'),
|
||||
alg_ruimte_key, 'R', 1, 'GEB-' || alg_gebouw_upper
|
||||
FROM alg_v_ruimte_gegevens
|
||||
WHERE alg_ruimte_upper_nr = '000';
|
||||
|
||||
|
||||
/* Formatted on 2008/11/20 10:57 (Formatter Plus v4.8.7) */
|
||||
INSERT INTO cnt_contract_object
|
||||
(cnt_contract_key, cnt_ins_srtdeel_key, cnt_ins_deel_key)
|
||||
SELECT cnt_contract_key,
|
||||
(SELECT ins_srtdeel_key
|
||||
FROM ins_srtdeel
|
||||
WHERE ins_srtdeel_omschrijving = 'Gebouwobjecten'), ins_deel_key
|
||||
FROM ins_deel d,
|
||||
alg_v_ruimte_gegevens rg,
|
||||
(SELECT cnt_contract_key, alg_gebouw_key
|
||||
FROM cnt_contract_plaats cp, alg_gebouw g
|
||||
WHERE cp.cnt_alg_plaats_code = 'L'
|
||||
AND cnt_alg_plaats_key = alg_locatie_key
|
||||
AND cnt_contract_plaats_verwijder IS NULL
|
||||
UNION ALL
|
||||
SELECT cnt_contract_key, cnt_alg_plaats_key
|
||||
FROM cnt_contract_plaats cp
|
||||
WHERE cp.cnt_alg_plaats_code = 'G'
|
||||
AND cnt_contract_plaats_verwijder IS NULL) rc
|
||||
WHERE alg_ruimte_upper_nr = '000'
|
||||
AND rg.alg_ruimte_key = d.ins_alg_ruimte_key
|
||||
AND d.ins_alg_ruimte_type = 'R'
|
||||
AND d.ins_srtdeel_key =
|
||||
(SELECT ins_srtdeel_key
|
||||
FROM ins_srtdeel
|
||||
WHERE ins_srtdeel_omschrijving = 'Gebouwobjecten')
|
||||
AND rc.alg_gebouw_key = rg.alg_gebouw_key
|
||||
AND rc.cnt_contract_key IN (SELECT cnt_contract_key
|
||||
FROM cnt_contract
|
||||
WHERE ins_discipline_key IN
|
||||
(382, 381, 385));
|
||||
|
||||
|
||||
UPDATE cnt_disc_params
|
||||
SET cnt_srtcontract_type = 1
|
||||
WHERE cnt_disc_params_key IN (
|
||||
SELECT dp.cnt_disc_params_key
|
||||
FROM cnt_discipline d, cnt_disc_params dp
|
||||
WHERE d.ins_discipline_key = dp.cnt_ins_discipline_key
|
||||
AND d.ins_discipline_verwijder IS NULL
|
||||
AND ins_discipline_key IN (382, 381, 385) -- lease, lev, overig
|
||||
);
|
||||
|
||||
UPDATE cnt_disc_params
|
||||
SET cnt_srtcontract_type = 5
|
||||
WHERE cnt_disc_params_key IN (
|
||||
SELECT dp.cnt_disc_params_key
|
||||
FROM cnt_discipline d, cnt_disc_params dp
|
||||
WHERE d.ins_discipline_key = dp.cnt_ins_discipline_key
|
||||
AND d.ins_discipline_verwijder IS NULL
|
||||
AND ins_discipline_key IN (384) -- lease, lev, overig
|
||||
);
|
||||
|
||||
DELETE cnt_contract_plaats
|
||||
WHERE cnt_contract_key IN (SELECT cnt_contract_key
|
||||
FROM cnt_contract
|
||||
WHERE ins_discipline_key IN (382, 381, 385));
|
||||
|
||||
|
||||
commit;
|
||||
|
||||
SPOOL OFF
|
||||
Reference in New Issue
Block a user