Home » Developer & Programmer » Reports & Discoverer » Help with discoverer parameter default values (disc 10.1.2)
Help with discoverer parameter default values [message #408780] Wed, 17 June 2009 15:24 Go to next message
aarti81
Messages: 235
Registered: December 2007
Location: USA
Senior Member
Hi all
I'm having two parameters From and To dates and i want the default values as:
From Date: SYSDATE-2years
To Date: SYSDATE
but when i enter the default value as SYSDATE-2 , I'm getting an error mesaage saying invalid value.Please any help will be great.

Thanks
Re: Help with discoverer parameter default values [message #408783 is a reply to message #408780] Wed, 17 June 2009 15:37 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't use Discoverer so I can't help, but - why did you subtract "2" from SYSDATE? Look what that means:
SQL> select sysdate, sysdate - 2 from dual;

SYSDATE    SYSDATE-2
---------- ----------
17.06.2009 15.06.2009

SQL>

"2 years ago" can be easily obtained by help of the ADD_MONTHS function:
SQL> select sysdate, add_months(sysdate, -2 * 12) from dual;

SYSDATE    ADD_MONTHS
---------- ----------
17.06.2009 17.06.2007

SQL>
As I've already said, this probably won't help in Discoverer, but - you might have learnt something.
Re: Help with discoverer parameter default values [message #408949 is a reply to message #408780] Thu, 18 June 2009 07:45 Go to previous messageGo to next message
SanthoshKumar_s
Messages: 28
Registered: March 2005
Location: Hyderabad
Junior Member

Hi Arti,

I believe that we cannot pass the values directly as SYSDATE -2.

Instead we can have a parameter as given below provided from date is -2 yrs in all the cases.(mean we need to hardcode it.)

We can have a parameter(condition) something like this which works fine in your case.

TABLE.COLUMN_NAME BETWEEN ADD_MONTHS (TRUNC (:FROM_DATE), -24) AND TRUNC (:TO_DATE)

Hope this solves your Issue.

Thanks
Santhosh..
Re: Help with discoverer parameter default values [message #409013 is a reply to message #408780] Thu, 18 June 2009 14:01 Go to previous message
aarti81
Messages: 235
Registered: December 2007
Location: USA
Senior Member
Thank you guys, that helped me a lot.
Previous Topic: REP-0736: There exist uncompiled program unit(s)
Next Topic: Interesting Conditional Formatting Problem
Goto Forum:
  


Current Time: Thu Mar 28 14:52:32 CDT 2024