Et case
sætning kan kun returnere én datatype. Så konverter tallene til strenge:
SELECT CASE
WHEN fourthlevel.case_type IN ('Complaint')
THEN
(SELECT cast(COUNT(*) as varchar2(255))
FROM work_days1
WHERE work_days1.business_date > fourthlevel.cdate
AND work_days1.business_date <=
COALESCE (fourthlevel.close_date, SYSDATE))
WHEN fourthlevel.case_type IN ('Enquiry')
THEN
(SELECT cast(COUNT(*) as varchar2(255))
FROM work_days1
WHERE work_days1.business_date > fourthlevel.create_date
AND work_days1.business_date <=
COALESCE (fourthlevel.close_date, SYSDATE))
WHEN fourthlevel.case_status = 'Cancelled'
THEN
'N/A'
END AS sla_days
FROM fourthlevel
Alternativt kan du returnere NULL
når de to betingelser ikke stemmer overens.