Setting up Parameters from a case expression
10:51 12 Nov 2015

I have a query made where I have made a case expression but I need a parameter based off the results of the case expressions.

I am using DB2, can anyone advise?

SELECT DRIVER_ID, NAME, DRIVER.USER9 AS PHONE
    , CASE WHEN TERMINAL_NUMBER IN ('42','9','75','54','52','40','42','41','6') THEN 'EAST' 
    WHEN TERMINAL_NUMBER IN ('0','8','43','48','47','2','46','50','4','5','49', '1') THEN 'WEST' 
    ELSE '' END AS REGION
    , DRIVER_TYPE
FROM DRIVER
WHERE ACTIVE_IN_DISP = 'True'
AND 
ORDER BY TERMINAL_NUMBER
WITH UR

As you can see I have two results from a case East or West and I would like those to be the parameters.

sql db2