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!

Checking PL/SQL var in an IF against a list of values returned by a SELECT?

793378Aug 24 2010 — edited Aug 24 2010
In my PL/SQL code, I've a variable and I want to check if the value of this var is in a list of values. This list of values I want to get directly from a select statement. Can I do something like below:
IF (v_var1 in (select col1 from <table> where <condition>))
THEN
   <do something>
ELSE
   <do something else>
END IF;
This post has been answered by 737905 on Aug 24 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2010
Added on Aug 24 2010
12 comments
6,546 views