oracle query - parameter question

select d.unit_id,
	   d.coll_date,
	   d.drive_id ||'-'||location_name as description,
	   d.procedure_code as don_procedure, 
	   a.attrib_code as lab_procedure
  from donations_don d,
       unit_attributes_lab a,
	   locations@pdon_new l,
	   drives@pdon_new	dr
 where d.coll_date between :start_date and :end_date
   and  d.drive_id = :drive_id
   and l.location_id = dr.location_id
   and dr.drive_id = d.drive_id
   and ((d.procedure_code = 'PP' and
         a.unit_id = d.unit_id and
		 a.attrib_group = 'PHER' and
		 a.attrib_code not in ('PP','TP','DP')) or
		(d.procedure_code = 'RP' and
         a.unit_id = d.unit_id and
		 a.attrib_group = 'PHER' and
		 a.attrib_code not in ('RD','RP'))	or
		(d.procedure_code = 'RS' and
         a.unit_id = d.unit_id and
		 a.attrib_group = 'PHER' and
		 a.attrib_code <> 'RS') or 
		(d.procedure_code = 'PL' and
         a.unit_id = d.unit_id and
		 a.attrib_group = 'PHER' and
		 a.attrib_code <> 'PL') or 
		(d.procedure_code = 'CO' and
         a.unit_id = d.unit_id and
		 a.attrib_group = 'PHER' and
		 a.attrib_code not in ('CO','CX')) or 
		(d.procedure_code = 'DR' and
         a.unit_id = d.unit_id and
		 a.attrib_group = 'PHER' and
		 a.attrib_code <> 'DR') or 
		(d.procedure_code = 'SR' and
         a.unit_id = d.unit_id and
		 a.attrib_group = 'PHER' and
		 a.attrib_code <> 'SR') )

Open in new window


parameters

:start_date
:end_date
:drive_id

Users wants to run either using :start_date and :end_date OR :drive_id

If date range is used then give all drives for that date range. If drive_id is used as a parameter then only data pertaining to that drive id has to be produced.
LVL 6
anumosesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Maybe something like this?

...
where
       (
        d.drive_id = :drive_id
        or
        d.coll_date between :start_date and :end_date
       )
and
...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anumosesAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.