ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to Adding a integer value to Date variable?

Post new topic  Reply to topic
 How to Adding a integer value to Date variable? « View previous topic :: View next topic » 
Author Message
kumar.shanj
PostPosted: Mon Jan 17, 2011 2:55 am    Post subject: How to Adding a integer value to Date variable? Reply with quote

Apprentice

Joined: 18 Nov 2010
Posts: 49

My requirement is to add some noOfDays to a Date variable in ESQL code of Compute node of Websphere Message broker.

When i am trying like
SELECT
CASE
WHEN
(cast(A.TERMINATION_DT as date FORMAT 'dd-mon-yy')
<= cast((CURRENT_DATE +1) as date FORMAT 'dd-mon-yy'))
THEN
A.TERMINATION_DT
ELSE
NULL
END AS EndDate
FROM
Database_VW AS A


I am getting a error like Invalid or incompatible data types for '+' operator.
Back to top
View user's profile Send private message
mgk
PostPosted: Mon Jan 17, 2011 3:07 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hello. Look at the INTERVAL datatype - you can declare an INTERVAL of a given number of DAYs.

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
kumar.shanj
PostPosted: Mon Jan 17, 2011 5:13 am    Post subject: Reply with quote

Apprentice

Joined: 18 Nov 2010
Posts: 49

But i need to find the difference between two dates and manupulation of date value by adding one day to the current date.

SELECT
CASE
WHEN
((A.TERMINATION_DT )
<= ((CURRENT_DATE +1 ) ) )
THEN
A.TERMINATION_DT
ELSE
NULL
END AS EndDate
FROM Database_VW AS A

Is there any way to add a number to a date variable to get output as date only?
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jan 17, 2011 5:17 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kumar.shanj wrote:
Is there any way to add a number to a date variable to get output as date only?


Yes. Look at the INTERVAL datatype
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kumar.shanj
PostPosted: Mon Jan 17, 2011 10:09 am    Post subject: Reply with quote

Apprentice

Joined: 18 Nov 2010
Posts: 49

SET put_Date = CURRENT_DATE + CAST(1 AS INTERVAL DAY);

This code is working.
Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jan 17, 2011 10:13 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kumar.shanj wrote:
This code is working.


Told you.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to Adding a integer value to Date variable?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.