oracle - Case expression in where clause PL/SQL -



oracle - Case expression in where clause PL/SQL -

how query in pl/sql?

declare l_batch_type number := 1; select * table t case when l_batch_type = 1 ('a', 'b') when l_batch_type = 2 ('c', 'd') when l_batch_type = 3 ('e', 'f') when l_batch_type null null end in t.batch_type;

i'm getting sql error: ora-00907: missing right parenthesis wrong ('x','y') values , in operator, can't figure out how match right syntax.

thanks!

you'd want utilize simple boolean logic rather putting case statement in where clause

where (l_batch_type = 1 , t.batch_type in ('a', 'b')) or (l_batch_type = 2 , t.batch_type in ('c', 'd')) or (l_batch_type = 3 , t.batch_type in ('e', 'f'))

since null never equal (and never unequal anything), i'm not sure whether l_batch_type null status intended add together logic.

oracle plsql case where

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -