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!

Using a Subquery with an "IN" keyword to create a dynamic list

704983Mar 1 2010 — edited Mar 1 2010
Good morning, anyone:

I am starting to dream out of the box. I have large column of codes that I don't want to hard code by hand, so I thought a simple test of the following would be the way to going:
Declare
v_code varchar2(20) := 'ZZZ';

Begin

IF v_code in (select GURIDEN_IDEN_CODE from Guriden) Then
DBMS_OUTPUT.PUT_LINE("This entry is good");
else DBMS_OUTPUT.PUT_LINE("This is not in the list");
End if;
End;
Well I got a dirty little message that said I couldn't use the sub query in this manner. So how can to create something similar?

Thanks

Preston@Large

Edited by: Preston@Large on Mar 1, 2010 7:42 AM
This post has been answered by Centinul on Mar 1 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 29 2010
Added on Mar 1 2010
8 comments
919 views