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: Cursors

Re: Cursors

From: Anne Crowther <anne.crowther_at_nospam.capgemini.co.uk>
Date: Tue, 16 Nov 1999 14:32:22 -0000
Message-ID: <80rpto$155$1@taliesin.netcom.net.uk>


A simple way to do this would be to pass the date values into your cursor when you open it:

CURSOR c1 (v_dateval DATE) IS
SELECT *
FROM mytab
WHERE datecol = v_dateval;

BEGIN

     IF valid parameter date THEN
          OPEN c1(p_date);
    ELSE
          OPEN c1(SYSDATE);

   END IF;
END; A Crowther
anne_at_nospam.osvif.demon.co.uk (remove nospam)

<amerar_at_ci.chi.il.us> wrote in message news:80ro6k$uo0$1_at_nnrp1.deja.com...
>
>
> Hello,
>
> I have a question about cursors. I want to define a cursor based upon
> parameters passed into my PL/SQL program.
>
> I want to look at the parameters the user passes in. If they are valid
> dates, I want to use those dates in my WHERE caluse. Otherwise, I want
> to use SYSDATE.
>
> How can I code a 'conditional' define for a CURSOR since it is done in
> the declaration section??
>
> Thanks,
>
> Arthur
> amerar_at_ci.chi.il.us
>
> PS. Please cc a copy to e-mail.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Nov 16 1999 - 08:32:22 CST

Original text of this message

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