DateTime parameter with NULL value is default

Hi,
I have a report with datetime parameter which is required to be optional (there should be an option not to select this parameter which would cause in not narrowing result of this report by this parameter).

I used datetime parameter @daTo (to have the calendar control for selecting date) and check on "Allow Null" value. Here is default Value.

I've also tried to set DefaultValue expression was "=Nothing".  

IN my query of data set, here is the part I use the parameter @daTo

 ... Where (@daTo IS NULL OR TRUNC(@daTo) >= TRUNC(pe.start_time) ....

But when I run the report, I got below error:

ORA-00932: inconsistent datatypes: expected DATE got NUMBER

I think it @daTo value actually not null so it try to TRunc the value

I don't know how to set null value default in my report. Any idea for help, please?

Thank you



July 4th, 2015 5:47am

Any help please ;-(
Free Windows Admin Tool Kit Click here and download it now
July 4th, 2015 10:08pm

Do you retrieve the data from Oracle? What is a datatype?
July 5th, 2015 1:35am

What is the datatype of start_time? Also why use TRUNC?

Can you try

TRUNC(pe.start_time,'dd')

Free Windows Admin Tool Kit Click here and download it now
July 5th, 2015 3:02am

Hi AnyMi, 

According to your description, you want to set the parameter default value to null, right? 

In your scenario, if @daTo is null, this expression will return 1 or 0. When you compare it with date, oracle will throw this error. You can modify it like this: Where (TRUNC(@daTo) >= TRUNC(pe.start_time)) OR (@daTo IS NULL). Also when using the TRUNC() function, make sure both dates are truncated at same level (like TRUNC(@daTo,dd)). 

If you have any question, please feel free to ask. 

Regards, 
Shrek Li

July 7th, 2015 2:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics