Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to do a condition query in where clause on a variable

Lior KerenJul 18 2023

Hello,

In my query (inside a procedure )

I need..

select … where

a.cust=b.cust

AND

IF var1='Y' THEN

branch in (select branch_name from branches)

ELSE

branch=var2;

ENDIF;

This is the logic,

Any idea how to implement it ?

This post has been answered by Frank Kulash on Jul 18 2023
Jump to Answer
Comments
Post Details
Added on Jul 18 2023
3 comments
747 views