/* Formatted on 2014/01/15 18:47 (Formatter Plus v4.8.8) */
SELECT DECODE (coverage1, NULL, 'No Coverage', coverage1) service_coverage,
DECODE (warranty1, NULL, 'No', warranty1) warranty
FROM (SELECT MAX (DECODE (cov.NAME,
'Servicepass Complete', DECODE (cle.sts_code,
'ACTIVE', cov.NAME,
NULL
),
'Servicepass Standard', DECODE (cle.sts_code,
'ACTIVE', cov.NAME,
NULL
),
'Qualitypass', DECODE (cle.sts_code,
'ACTIVE', cov.NAME,
NULL
),
NULL
)
) coverage1,
MAX (DECODE (cov.NAME,
'WARRANTY', DECODE (cle.sts_code,
'ACTIVE', 'Yes',
'No'
),
NULL
)
) warranty1
FROM okc_k_lines_b cle,
oks_k_lines_b kln,
okc_k_lines_tl cov,
okc_line_styles_tl lse,
okc_statuses_tl sts,
okc_k_items cit,
oks_auth_lines_v x
WHERE cle.cle_id IS NULL
AND kln.cle_id = cle.ID
AND lse.ID = cle.lse_id
AND lse.LANGUAGE = USERENV ('LANG')
AND cit.cle_id = cle.ID
AND cit.jtot_object1_code IN
('OKX_SERVICE', 'OKX_WARRANTY', 'OKX_USAGE',
'OKS_SUBSCRIPTION')
AND sts.code = cle.sts_code
--AND sts.meaning NOT IN ('Terminated')
AND sts.LANGUAGE = USERENV ('LANG')
AND cov.ID(+) = kln.coverage_id
AND cov.LANGUAGE(+) = USERENV ('LANG')
AND x.cle_id = cle.ID
AND (x.ID IN (
SELECT cle_id
FROM okc_k_items
WHERE dnz_chr_id = cit.dnz_chr_id
AND object1_id1 IN (
SELECT instance_id
FROM csi_item_instances
WHERE 1 = 1
AND serial_number = NVL (:1, serial_number)))
))
SELECT DECODE (coverage1, NULL, 'No Coverage', coverage1) service_coverage,
DECODE (warranty1, NULL, 'No', warranty1) warranty
FROM (SELECT MAX (DECODE (cov.NAME,
'Servicepass Complete', DECODE (cle.sts_code,
'ACTIVE', cov.NAME,
NULL
),
'Servicepass Standard', DECODE (cle.sts_code,
'ACTIVE', cov.NAME,
NULL
),
'Qualitypass', DECODE (cle.sts_code,
'ACTIVE', cov.NAME,
NULL
),
NULL
)
) coverage1,
MAX (DECODE (cov.NAME,
'WARRANTY', DECODE (cle.sts_code,
'ACTIVE', 'Yes',
'No'
),
NULL
)
) warranty1
FROM okc_k_lines_b cle,
oks_k_lines_b kln,
okc_k_lines_tl cov,
okc_line_styles_tl lse,
okc_statuses_tl sts,
okc_k_items cit,
oks_auth_lines_v x
WHERE cle.cle_id IS NULL
AND kln.cle_id = cle.ID
AND lse.ID = cle.lse_id
AND lse.LANGUAGE = USERENV ('LANG')
AND cit.cle_id = cle.ID
AND cit.jtot_object1_code IN
('OKX_SERVICE', 'OKX_WARRANTY', 'OKX_USAGE',
'OKS_SUBSCRIPTION')
AND sts.code = cle.sts_code
--AND sts.meaning NOT IN ('Terminated')
AND sts.LANGUAGE = USERENV ('LANG')
AND cov.ID(+) = kln.coverage_id
AND cov.LANGUAGE(+) = USERENV ('LANG')
AND x.cle_id = cle.ID
AND (x.ID IN (
SELECT cle_id
FROM okc_k_items
WHERE dnz_chr_id = cit.dnz_chr_id
AND object1_id1 IN (
SELECT instance_id
FROM csi_item_instances
WHERE 1 = 1
AND serial_number = NVL (:1, serial_number)))
))
No comments:
Post a Comment