Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

User-filtered report based on date range

510477Jul 6 2006 — edited Jul 13 2006
I am struggling with trying to implement a basic search that includes an optional date range for the data. The form looks the way I want it, but I can't seem to get the right syntax in the query. I can't get anything other than "no rows" to show up in the query if I implement a clause selecting records based on the time.

Here is a working query (without the time):

select m.AUDIT_ID, m.TIMESTAMP, m.LOC_ID, a.AREA, s.SUBAREA, d.OBSERVATIONS
from transys.SAFETY_AUDIT_MAIN m, transys.SAFETY_AUDIT_DETAIL d,
transys.SAFETY_AUDIT_AREA a, transys.SAFETY_AUDIT_SUBAREA s
where m.AUDIT_ID = d.AUDIT_ID (+)
and d.AREA_ID = a.AREA_ID
and d.SUBAREA_ID = s.SUBAREA_ID
and s.SUBAREA_ID NOT IN (198,199,398,399,498,499,798,799,898,899,999)
and (instr(upper(a.AREA),upper(nvl(:P210_SEARCH,AREA))) > 0
or instr(upper(s.SUBAREA),upper(nvl(:P210_SEARCH,SUBAREA))) > 0
or instr(upper(d.OBSERVATIONS),upper(nvl(:P210_SEARCH,OBSERVATIONS))) > 0)

I want to compare the m.TIMESTAMP column with page items P210_FROM_DATE and P210_TO_DATE.

I would also like to add in an optional filter comparing m.LOC_ID to P210_LOCATION, and I can't seem to figure out the "optional" part.

Any ideas would be helpful.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2006
Added on Jul 6 2006
11 comments
1,469 views