CONN verschil in ruimtesoort

svn path=/Database/trunk/; revision=9018
This commit is contained in:
Arthur Egberink
2005-08-17 10:26:58 +00:00
parent 79a9eb557d
commit 013d2b84a3

View File

@@ -273,8 +273,7 @@ UNION
CREATE_VIEW(cnt_v_contract_huurder, CNT_NORMAAL_PRIVILEGE)
CREATE OR REPLACE VIEW CNT_V_CONTRACT_HUURDER
(ALG_ONRGOED_KEY, CNT_CONTRACT_KEY, CNT_SRTCONTRACT_KEY, CNT_PRS_BEDRIJF_KEY1, CNT_PRS_AFDELING_KEY1,
CNT_CONTRACT_ONRGOED_KEY, CNT_CONTRACT_ONRGOED_OPP1, CNT_CONTRACT_ONRGOED_TYPE1, CNT_MLD_MELDING_KEY, CNT_PRS_BEDRIJF_KEY2,
CNT_PRS_AFDELING_KEY2, CNT_CONTRACT_ONRGOED_KEY2, CNT_CONTRACT_ONRGOED_OPP2, CNT_CONTRACT_ONRGOED_TYPE2, CNT_CONTRACT_KEY2)
@@ -286,14 +285,14 @@ select alg_onrgoed_key
,(select c.cnt_PRS_AFDELING_KEY from cnt_contract c where c.cnt_contract_key = mut.org_contract_key) as CNT_PRS_AFDELING_KEY1
,org_contract_onrgoed_key as CNT_CONTRACT_ONRGOED_KEY
,org_contract_onrgoed_opp AS CNT_CONTRACT_ONRGOED_OPP1
,NVL((select sr.alg_srtruimte_code from alg_srtruimte sr where sr.alg_srtruimte_key = mut.org_alg_srtonrgoed_key),
,NVL((select sr.alg_srtruimte_code from alg_srtruimte sr where sr.alg_srtruimte_key = mut.org_alg_srtonrgoed_key and mut.alg_onrgoed_niveau = 'R'),
(select st.alg_srtterreinsector_code from alg_srtterreinsector st where st.alg_srtterreinsector_key = mut.org_alg_srtonrgoed_key)) AS CNT_CONTRACT_ONRGOED_TYPE1
,cnt_melding_key AS CNT_MLD_MELDING_KEY
,(select c.cnt_PRS_BEDRIJF_KEY from cnt_contract c where c.cnt_contract_key = mut.mut_contract_key) as CNT_PRS_BEDRIJF_KEY2
,(select c.cnt_PRS_AFDELING_KEY from cnt_contract c where c.cnt_contract_key = mut.mut_contract_key) as CNT_PRS_AFDELING_KEY2
,mut_contract_onrgoed_key as CNT_CONTRACT_ONRGOED_KEY2
,mut_contract_onrgoed_opp AS CNT_CONTRACT_ONRGOED_OPP2
,NVL((select sr.alg_srtruimte_code from alg_srtruimte sr where sr.alg_srtruimte_key = mut.org_alg_srtonrgoed_key),
,NVL((select sr.alg_srtruimte_code from alg_srtruimte sr where sr.alg_srtruimte_key = mut.org_alg_srtonrgoed_key and mut.alg_onrgoed_niveau = 'R'),
(select st.alg_srtterreinsector_code from alg_srtterreinsector st where st.alg_srtterreinsector_key = mut.mut_alg_srtonrgoed_key)) AS CNT_CONTRACT_ONRGOED_TYPE2
,mut_contract_key
from (
@@ -306,7 +305,8 @@ select alg_onrgoed_key
cogm.cnt_contract_key as mut_contract_key,
cogm.cnt_contract_onrgoed_key as mut_contract_onrgoed_key,
cogm.cnt_contract_onrgoed_opp as mut_contract_onrgoed_opp,
cogm.alg_srtonrgoed_key as mut_alg_srtonrgoed_key
cogm.alg_srtonrgoed_key as mut_alg_srtonrgoed_key,
cogo.alg_onrgoed_niveau as alg_onrgoed_niveau
FROM cnt_contract_onrgoed cogo,
cnt_contract_onrgoed cogm
WHERE cogo.cnt_contract_onrgoed_key = cogm.cnt_contract_onrgoed_key_org
@@ -320,27 +320,29 @@ select cogo.ALG_ONRGOED_KEY,
cogo.cnt_contract_onrgoed_key as org_contract_onrgoed_key,
cogo.cnt_contract_onrgoed_opp as org_contract_onrgoed_opp,
cogo.alg_srtonrgoed_key as org_alg_srtonrgoed_key,
to_number(null) as mut_contract_key,
to_number(null) as mut_contract_onrgoed_key,
to_number(null) as mut_contract_onrgoed_opp,
to_number(null) as mut_alg_srtonrgoed_key
TO_NUMBER(null) as mut_contract_key,
TO_NUMBER(null) as mut_contract_onrgoed_key,
TO_NUMBER(null) as mut_contract_onrgoed_opp,
TO_NUMBER(null) as mut_alg_srtonrgoed_key,
cogo.alg_onrgoed_niveau as alg_onrgoed_niveau
FROM cnt_contract_onrgoed cogo
WHERE cogo.cnt_contract_onrgoed_key NOT in (select cnt_contract_onrgoed_key_org from cnt_contract_onrgoed where cnt_contract_onrgoed_key_org is not null) AND
cogo.cnt_mld_melding_key IS NULL
union all
select cogm.ALG_ONRGOED_KEY,
cogm.cnt_mld_melding_key as cnt_melding_key,
to_number(null) as org_contract_key,
to_number(null) as org_contract_onrgoed_key,
to_number(null) as org_contract_onrgoed_opp,
to_number(null) as org_alg_srtonrgoed_key,
TO_NUMBER(null) as org_contract_key,
TO_NUMBER(null) as org_contract_onrgoed_key,
TO_NUMBER(null) as org_contract_onrgoed_opp,
TO_NUMBER(null) as org_alg_srtonrgoed_key,
cogm.cnt_contract_key as mut_contract_key,
cogm.cnt_contract_onrgoed_key as mut_contract_onrgoed_key,
cogm.cnt_contract_onrgoed_opp as mut_contract_onrgoed_opp,
cogm.alg_srtonrgoed_key as mut_alg_srtonrgoed_key
cogm.alg_srtonrgoed_key as mut_alg_srtonrgoed_key,
cogm.alg_onrgoed_niveau as alg_onrgoed_niveau
FROM cnt_contract_onrgoed cogm WHERE cogm.cnt_mld_melding_key IS NOT NULL
and cogm.cnt_contract_onrgoed_key_org IS NULL
)mut;
)mut
/