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: Conditional Where clause in stored proc

Re: Conditional Where clause in stored proc

From: Steven Franklin <steven.franklin_at_wcom.com>
Date: Thu, 29 Jul 1999 15:12:02 GMT
Message-ID: <37A06F42.3A09EAC4@wcom.com>


use the DBMS_SQL package to define your SQL at runtime.

bgeake_at_my-deja.com wrote:

> How can a select procedure have its Where clause set conditionally
> depending on a paramater value?
>
> Depending on the value, I need to use the clause "And complete_by_date
> <= Sysdate" or "And complete_by_date <= Sysdate + 7" or "And
> Months_Between(complete_by_date,Sysdate) <= 1".
>
> I've tried:
> If parameter = value1 Then And complete_by_date <= Sysdate;
> Elsif parameter = value2 Then And complete_by_date <= Sysdate + 7;
> Elsif parameter = value3 Then And Months_Between
> complete_by_date,Sysdate) <= 1;
> End If;
>
> which gives lots of PLS-00103 errors. So what's the real way to do this?
>
> TIA,
>
> Bill.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Thu Jul 29 1999 - 10:12:02 CDT

Original text of this message

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