Link to home
Start Free TrialLog in
Avatar of syhctl
syhctl

asked on

ORACLE SQL/PL case statement - using with IN LIST

Hi all,
I have writtent he following CASE Statement in the
criteria for DeptID
DEPTID =
CASE :1 WHEN '12345'  
THEN   '555111'   END  -- This works and brings back the specified department.
I have tried many ways to add more deparment numbers but I get a an error.
I've tried
CASE :1 WHEN '12345'  
THEN IN ("555111','12345')

also I have tried:
CASE :1 WHEN '12345'  
THEN DEPTID IN ("555111','123456')
The only one that works is when I have only one department number.  Is this because CASE statements bring only bring back 1 result?
Thanks much for your help.
Syhctl

Is there a way for me to list more than one dept number in a Case Statement without have to create multiple Statements?
Thanks,
Syhctl
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial