Re: Using string variables in Select statements

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 01 May 2008 09:30:22 -0700
Message-ID: <1209659420.579845@bubbleator.drizzle.com>


okumura-mikiop_at_jvc-victor.jp wrote:
> I am attempting to use a variable in the WHERE clause of a SELECT statement.
> How would one pass a value for an IN statement, ie.
>
> SELECT *
> FROM inventory
> WHERE color IN ('red','green')
>
> If I replaced the last line with
>
> WHERE color IN (v_color)
>
> How would I set it?
>
> v_color := '"red","green"'
>
> doesn't work.

There is a demo of how to do it in Morgan's Library at www.psoug.org Click on Morgan's Library under Resources on the left. Click on Conditions
Scroll down to "Complex IN Demo."

Some of what it demos is what does NOT work so run the complete demo and then use what works.

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Thu May 01 2008 - 11:30:22 CDT

Original text of this message