View previous topic :: View next topic |
Author |
Message |
coolguy Beginner

Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Thu Jul 26, 2007 4:39 am Post subject: Date Addition |
|
|
Hi Friends
I want to calculate some Date funcion
1) I am reading the Date from the file and i and doing some calulations and add 1 day to the date and do the same calution , i want to do same options upto the current date , how to do add days in DB2 could you pleas help me in that
Thanks
Cool |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Thu Jul 26, 2007 6:38 am Post subject: |
|
|
coolguy,
Try this
Code: |
SELECT DATE(CURRENT DATE + 1 DAYS)
FROM
SYSIBM.SYSDUMMY1
;
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
coolguy Beginner

Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Thu Jul 26, 2007 6:47 am Post subject: |
|
|
Thanks Kolusu But i want to use date which i am reading from the file, not current date please help in this
Cool |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Thu Jul 26, 2007 6:58 am Post subject: |
|
|
coolguy,
try this
Code: |
ws-file-date pic x(10).
SELECT DATE(:ws-file-date) + 1 DAYS
FROM
SYSIBM.SYSDUMMY1
;
|
Kolusu |
|
Back to top |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Thu Jul 26, 2007 7:01 am Post subject: |
|
|
DB2 has a full set of date functions -- look in the sql reference manual. |
|
Back to top |
|
 |
coolguy Beginner

Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Fri Jul 27, 2007 1:37 am Post subject: |
|
|
Hi Kolusu
Thanks a lot for the kindly help but i am facing the other problem
I am using the code Code: |
ws-file-date pic x(10).
ws-fromdate Pic x(10)
SELECT DATE((:WS-FILEDATE) - 1 DAYS)
INTO :WS-FROMDATE
FROM SYSIBM.SYSDUMMY1
But i am getting the Error while binding
as follows
DSNX200I - BIND SQL ERROR
USING TRP001 AUTHORITY
PLAN=HISTLOD1
DBRM=HISTLOAD
STATEMENT=923
SQLCODE=-171
SQLSTATE=42815
TOKENS=2 -
CSECT NAME=DSNXOBFA
RDS CODE=30
DSNT201I - BIND FOR PLAN HISTLOD1 NOT SUCCESSFUL
|
i have checked for the sql code -171
(ie THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT nn OF function-name IS INVALID)
Could you please guide me to slove this issue
Thanks
Cool |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
coolguy Beginner

Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Mon Jul 30, 2007 3:24 am Post subject: |
|
|
Kolusu
You are correct. Thanks a lot.
Cool |
|
Back to top |
|
 |
|
|