Home » Developer & Programmer » Reports & Discoverer » Date function to be used in reports..QRY
Date function to be used in reports..QRY [message #259660] Thu, 16 August 2007 04:02 Go to next message
suma_orkl
Messages: 16
Registered: July 2007
Junior Member
Hi all
Im doing a report. The report is for a particular week. I have a function to calculate the start and end dates of the input week.
I need a function to increment the date by 1day.
I wrote this but its returning an error

return to_date(:begin_week+1,'dd-mon-rr')

Pl share if any body knows how to increment the date by 1 day.

-Suma
Re: Date function to be used in reports..QRY [message #259680 is a reply to message #259660] Thu, 16 August 2007 04:31 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Add "1" to a date, not string.
SQL> -- this is what you do - add 1 to a string '16-kol-07'

SQL> select to_date('16-kol-07' + 1, 'dd-mon-rr') result from dual;
select to_date('16-kol-07' + 1, 'dd-mon-rr') result from dual
               *
ERROR at line 1:
ORA-01722: invalid number


SQL> -- this is how it should be done - convert string to a date (using TO_DATE) and then add 1

SQL> select to_date('16-kol-07', 'dd-mon-rr') + 1 result from dual;

RESULT
--------
17.08.07

SQL>
Re: Date function to be used in reports..QRY [message #259685 is a reply to message #259680] Thu, 16 August 2007 04:39 Go to previous message
suma_orkl
Messages: 16
Registered: July 2007
Junior Member
Hello littlefoot,

Thank yu so much for ur reply
now its working

-Suma
Previous Topic: passing parameters...
Next Topic: list box for passing parameters
Goto Forum:
  


Current Time: Fri Jul 05 10:28:09 CDT 2024