Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL question, Please help
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_at_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.Received on Thu Jun 06 2002 - 16:07:50 CDT