Path: news.easynews.com!easynews!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!wn1feed!wn4feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail
From: John Russell <netnews3@johnrussell.mailshell.com>
Newsgroups: comp.databases.oracle.server
Subject: Re: PL/SQL question, Please help
Message-ID: <lfjvfu8gnl3n6gt7s39flte6basn8qtn0s@4ax.com>
References: <41266446.0206060746.37476677@posting.google.com>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 35
NNTP-Posting-Host: 12.232.220.154
X-Complaints-To: abuse@attbi.com
X-Trace: sccrnsc01 1023397669 12.232.220.154 (Thu, 06 Jun 2002 21:07:49 GMT)
NNTP-Posting-Date: Thu, 06 Jun 2002 21:07:49 GMT
Organization: AT&T Broadband
Date: Thu, 06 Jun 2002 21:07:50 GMT
Xref: easynews comp.databases.oracle.server:149791
X-Received-Date: Thu, 06 Jun 2002 14:05:15 MST (news.easynews.com)

When you build up a string like this inside a SELECT statement, you
have to turn the whole thing into a single string and run that using
the EXECUTE IMMEDIATE statement.

http://tahiti.oracle.com/pls/db92/db92.sql_keywords?letter=E#index-EX

John

On 6 Jun 2002 08:46:26 -0700, zheli2001@yahoo.com (Jeff) wrote:
>Hello All:
>
>     In a PL/SQL procedure, I was tring to use a "in" statment in a select
>     query. But for some reason it didn't work right. Here is my code:
>
>     SQL> declare
>       2       v_addtype  varchar2(100) := '''m'',''mb''';
>       3      i number;
>       4  Begin
>       5       SELECT count(*) into i
>       6       FROM  UserAddr
>       7       WHERE addrtype in (v_addtype);
>       8       DBMS_OUTPUT.put_line('##### count = ' || i||' #####' );
>       9  End;
>      10  /
>     ##### count = 0 #####
>
>     PL/SQL procedure successfully completed.

--
Got an Oracle database question?
Try the search engine for the database docs at:
http://tahiti.oracle.com/

The opinions expressed above are mine and do not
necessarily reflect those of Oracle Corporation.
