What about this example:

declare
      type      m_curs_type is REF CURSOR;   
      m_curs    m_curs_type;
      m_str     varchar2(200) := '(1,2,3,4)';
      m_sql     varchar2(1000);
      m_ret     varchar2(20);
  begin
      m_sql := 'select 100 hh from dual where 1 in '||m_str;
      OPEN m_curs FOR m_sql;
      loop
          FETCH m_curs INTO m_ret;
          exit when m_curs%notfound;
          dbms_output.put_line(m_ret);
      end loop;
      CLOSE m_curs;
  end;


Waleed
-----Original Message-----
Sent: Monday, October 07, 2002 12:54 PM
To: Multiple recipients of list ORACLE-L


List

        Is it possible to pass a comma seperated list of variables to
make up a portion of the in clause in a stored procedure

I have a list of variables IdList that looks like this
(1,2,3,4,5,66,77,88,someothernumbers)


    PROCEDURE MyProc
    (
        IdList IN VARCHAR
        SelectCursor OUT SelectRefCursor
    )

   IS
 BEGIN
OPEN SelectCursor FOR
 SELECT          * 
 FROM            MyTable
WHERE           ID IN ( IdList );
EXCEPTION

      WHEN OTHERS THEN
....   

   END MyProc;  

thanks
bob
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Bob Metelsky
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Khedr, Waleed
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to