Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: pl/sql problem

Re: pl/sql problem

From: Philippe <parnaud_at_yahoo.com>
Date: 27 Aug 1998 06:06:16 GMT
Message-ID: <01bdd180$b2d7d430$2a822c95@pdcpm>


Your syntax to pass variable to a cursor is wrong and you can't use a variable with an IN operator: Use the DBMS_SQL package to execute dynamic SQL. Min Wang <mwang_at_colorbank.com> wrote in article <35E48AF7.2140C899_at_colorbank.com>...
> Hi:
>
> I have a pl/sql problem.
>
> When I did:
>
> CREATE OR REPLACE ...
>
> IS
>
> CURSOR 1_cursor IS
>
> select ...
> from table_1
> where client in ('A','B','C')
> and ..
> ...
>
> BEGIN
>
> for c1 in 1_cursor loop
>
> ....
>
> end loop;
> END;
>
>
> Everything works fine. But when I have to do like:
>
> CREATE OR REPLACE ..
>
> IS
>
> all_client VARCHAR2(512);
> CURSOR 1_cursor IS
> select ...
> from table_1
> where client in (all_client)
> and ...
> ...
>
> BEGIN
> all_client := '''A'',''B'',''C''';
>
> for c1 in 1_cursor loop
>
> .......
>
> end loop;
>
> .....
>
> END;
>
> It returns nothing.
>
> Could someone tell me what's the problem?
>
> Thanks.
>
Received on Thu Aug 27 1998 - 01:06:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US