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

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL question

Re: PL/SQL question

From: Martin Haltmayer <Martin.Haltmayer_at_0800-einwahl.de>
Date: 2000/02/17
Message-ID: <38AB445E.A1BBA52F@0800-einwahl.de>#1/1

Hi Dana,

try

CURSOR cr_result IS
SELECT id, name
FROM employee
WHERE name IN in_names
and in_names is not null

--
union all
--
SELECT id, name
FROM employee
WHERE 1 = 1
and in_names is null
;

Martin



Dana Jian wrote:

>
> Hi,
>
> I need implement a procedure which takes input parameters for limiting
> records in the cursor defined in the proc.
> 1) the input parameter is a string contains the name list of the employee
> which need to be retrieved, like '(Mulan, Tom, Laysee...)"
> 2) If the input parameter is empty, return all the employees in the cursor
>
> Let's see the simple code,
>
> PROCEDURE SP_TEST
> (
> in_names IN VARCHAR2,
> .....
> CURSOR cr_result IS
> SELECT id, name
> FROM employee
> WHERE name IN in_names;
>
> The problem is this code doesn't suit my need of #2. A bad idea is just
> conditionally creating several cursor by checking the input parameter---that
> would not be a good one.
>
> Any good idea?
>
> Thanks a lot!
>
> Dana
> djian_at_trasa.com
Received on Thu Feb 17 2000 - 00:00:00 CST

Original text of this message

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