View previous topic :: View next topic
|
Author |
Message |
luban
New User
Joined: 19 Nov 2005 Posts: 26 Location: Shanghai, China
|
|
|
|
Hi,
Can any person tell me how to get current date by spufi?
Thank you.
Ban |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi LUBAN,
This can help you
Code: |
SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1; |
Sushanth |
|
Back to top |
|
|
luban
New User
Joined: 19 Nov 2005 Posts: 26 Location: Shanghai, China
|
|
|
|
Hi Sushanth,
Actually, I need to run a job every day, to get data of previous day.
So the spufi will be like:
SELECT MY_DATA FROM MY_TABLE
WHERE
MY_DATA = previous date (YYYYMMDD);
How can I get previous date ( I think current - 1 ) in form YYYYMMDD?
Anyone can help?
Thank you.
Ban |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Are weekends and holidays the handled same as "regular" days or is there some consideration for these that is not the same? |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Luban,
If you want just the previous day date, you can use this query.
Code: |
SELECT ( CURRENT DATE - 1 DAY ) AS YESTERDAY
, ( CURRENT DATE ) AS TODAY
FROM SYSIBM.SYSDUMMY1
; |
Code: |
previous date (YYYYMMDD); |
Since you put it in this way, are you looking for BUSINESS previous day. If that so, you must write a function or procedure to get that, taking into consideration with things like festival holiday, bank holiday, country holiday and more holidays like that. You are looking for an year calender.
Sushanth |
|
Back to top |
|
|
|