|
View previous topic :: View next topic
|
| Author |
Message |
arun nehra
New User
.jpg)
Joined: 29 Nov 2008 Posts: 62 Location: mumbai
|
|
|
|
Hi,
I have a question on the declaration of CURSOR in DB2. My existing program uses CURSOR to fetch records from a DB2 table and then my program further filter out records that are 2 days old (by comparing maintenance date which is part of table variable).
Now i want to modify this logic and want that the extarcted records from cursor itself should be 2 days old. So my first question is, if it is feasible to use such a logic using system date variable like 'CURRENT-DATE' etc.
And if it is then what all process/precautions i need to follow to achieve the above objective.
Thanks in advance.
Arun |
|
| Back to top |
|
 |
cvishu
Active User

Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
When you use 'CURRENT-DATE' it will be the system date , normally bussiness applications prefer to use their own business dates to avoid issues when processing on business holidays.
Just a friendly tip , get you requiremnts clarified. |
|
| Back to top |
|
 |
sushanth bobby
Senior Member

Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Arun,
In DB2, CURRENT DATE gets you the current system date and you can use that in a query.
For example:,
| Code: |
| select current date from sysibm.sysdummy1; |
You might need a where clause like
| Code: |
| WHERE you-date-column > CURRENT DATE - 2 DAYS; |
Thank You,
Sushanth |
|
| Back to top |
|
 |
arun nehra
New User
.jpg)
Joined: 29 Nov 2008 Posts: 62 Location: mumbai
|
|
|
|
Thanks All,
I will do the needful.
Regards |
|
| Back to top |
|
 |
|
|