Vitrum Vitrum - 1 year ago 94
SQL Question

sql oracle in() clause

Is it possible to use

clause in
case.. when ...the
construction in sql query condition expression.

im my case the query is very long:

select r.insurance_package_id,,
max(case r.insurance_package_id when 6 then
when 7 then
when 8 then
when 9 then
when 10 then
when 11 then
when 12 then
when 14 then
when 42 then
when 44 then
when 7 then

end) CPI_Life

there are about 200 id supposed to be used in condition expression: thus, the query would be very brut.

Answer Source

It is possible .Please refer the below snippet

SELECT r.insurance_package_id
            WHEN r.insurance_package_id IN (
                THEN r.NAME
            END) CPI_Life
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download