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: Dynamic query IN()-condition for cursor stored procedure

Re: Dynamic query IN()-condition for cursor stored procedure

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Mon, 31 May 2004 13:15:34 -0700
Message-ID: <1086034541.925051@yasure>


Bark Mark wrote:

> Hello,
>
>
> I want a dynamic IN-condition for my cursor in a stored procedure...
> let's say it is comparable with this example :
>
> SET SERVEROUTPUT ON
>
> DECLARE
>
> i PLS_INTEGER;
> InStr VARCHAR2(20) := '10,30';
>
> BEGIN
> SELECT COUNT(*)
> INTO i
> FROM emp
> WHERE deptno IN (InStr);
>
> dbms_output.put_line(i);
> END;
> /
>
>
> this needs to return "9", but it returns a "0". If you use it with
> Instr = '10' it works, in all other cases I'm stuck with it...
>
> Hope someone can help asap, it's a little bit urgent...
>
>
> Thanks a lot
>
> Bark Mark

Help me out here Bark Mark ... this exact question was asked in this forum in mid-January of this year. And I mean EXACT QUESTION because in the previously asked question the following example was used:

i PLS_INTEGER;
x InStrTab := InStrTab('10','30');

which varies from your example:

 > i PLS_INTEGER;
 > InStr VARCHAR2(20) := '10,30';

By not enough to be a coincidence. So please explain why this is. Because right now my conclusion is that this is school work, what with this being finals week, and that you are asking someone here to help you cheat.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Mon May 31 2004 - 15:15:34 CDT

Original text of this message

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