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

Conditional Where clause in stored proc

From: <bgeake_at_my-deja.com>
Date: Thu, 29 Jul 1999 14:24:11 GMT
Message-ID: <7npo61$lra$1@nnrp1.deja.com>


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 - 09:24:11 CDT

Original text of this message

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