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 -> PL/SQL Using Variable IN Clause

PL/SQL Using Variable IN Clause

From: Robert Fernandes <rfernand_at_llnl.gov>
Date: 1997/11/20
Message-ID: <34746C85.86E636A6@llnl.gov>#1/1

I have spent much too much time trying to figure this one out on my own and it's now time to ask for some help...

I am trying to create a procedure with the following:

PROCEDURE PROC(LIST_STRING IN VARCHAR2)
  RESULT NUMBER;
IS
BEGIN   <DO SOME STUFF>

  SELECT COUNT(*) INTO RESULT
  FROM <TABLE>
  WHERE <COL_A> = 'VALUE'
  AND <COL_B> IN(LIST_STRING); <-- Help Here!

  IF RESULT >= 1 THEN
<DO SOME STUFF>

  ELSE
<DO SOME STUFF>

  END IF; END; I have not been able to make this work. If I run as PROC('TEST') then it works as expected, but if I run as PROC('TEST,MORE') then it will not pick up the second value - which is expected. So then I tried doing a search and replace on the LIST_STRING with , for ',' and it still didn't work.

Replacing the LIST_STRING with 'TEST','MORE' within the select works as expected, so the bottom line is whether or not a single comma delimited string can be passed in and some way manipulated to work within the in clause.

Any help would be greatly appreciated. Thank you.

-- 
 ___ ___ ___ ___ ___ ____   ___ ___ ___ _  _  _   _  _ ___ ___  ___
| _ \   | _ \ __| _ \   _| | __| __| _ \ \| |/ \ | \| |   \ __|/ __/
|  _/ | | _ < _||  _/| |   | _|| _||  _/    | _ \|    | | | _| \__ \
|_|_\___|___/___|_|_\|_|   |_| |___|_|_\_|\_|/ \_\_|\_|___/___|/___/

********************************************************************
        Robert Fernandes - LLNL AIS Dept

        Phone:  (510) 423-1397     Fax:  (510) 423-5882
        Email:  rfernand_at_llnl.gov - or - fernandes6_at_llnl.gov
********************************************************************
Received on Thu Nov 20 1997 - 00:00:00 CST

Original text of this message

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