Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very Urgent query Help Needed

Status
Not open for further replies.

urchin556

IS-IT--Management
Mar 14, 2004
22
US
Hi Guys,
I need a urgent solution for a problem.I am
using the following query

select ename from emp where deptno =10

Now I will declare a bind variable and if user passes 'A'
then the query will run as it is and if he passes B
then it should run the above query with this additional clause -> birthdate - hiredate >15.
Please can any one help its very urgent
 
Urchin,

Try this:
Code:
select ename from emp where deptno =10
and (:bind_var = 'A' or 
    (:bind_var = 'B' and (birthdate - hiredate >15)));

Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 17:55 (02Oct04) UTC (aka "GMT" and "Zulu"), 10:55 (02Oct04) Mountain Time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top