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 » Truncate function - esql

Post new topic  Reply to topic
 Truncate function - esql « View previous topic :: View next topic » 
Author Message
vijayakumar
PostPosted: Thu Aug 11, 2011 12:28 pm    Post subject: Truncate function - esql Reply with quote

Centurion

Joined: 01 Aug 2010
Posts: 101

I used truncate function in my esql.

TRUNCATE(InputRoot.XML.CodeNumber, 2)
My input Code Number should be like 14998.27654

I want to convert it in to 14998.27


I got the error as

Illegal 1st argument (value ''14998.27654'') to function TRUNCATE; numeric value required; value of 2nd argument was '2'.

Then I changed the code to

TRUNCATE(cast(InputRoot.XML.CodeNumber as INTEGER), 2),

Now I am getting the error as

Error casting character string '14998.27654' to an integer .


Kindly advise how to use this.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 11, 2011 12:33 pm    Post subject: Re: Truncate function - esql Reply with quote

Grand High Poobah

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

vijayakumar wrote:
Error casting character string '14998.27654' to an integer .


Kindly advise how to use this.


Learn the difference between an integer and a decimal?

Then you might realise why WMB is telling you that '14998.27654' can't be converted to that data type.

This is a problem with your mathmatics, not your ESQL.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
vijayakumar
PostPosted: Thu Aug 11, 2011 12:46 pm    Post subject: Reply with quote

Centurion

Joined: 01 Aug 2010
Posts: 101

TRUNCATE(InputRoot.XML.CodeNumber, 2)

Illegal 1st argument (value ''14998.27654'') to function TRUNCATE; numeric value required; value of 2nd argument was '2'.


From which data type to which one , I have to cast to make the function work
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 11, 2011 12:50 pm    Post subject: Reply with quote

Grand High Poobah

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

vijayakumar wrote:
From which data type to which one , I have to cast to make the function work


Did you even read my previous post?

Or did you just glance at it, not see any new ESQL and decide to ask the question again?

Seriously.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 11, 2011 12:57 pm    Post subject: Reply with quote

Grand High Poobah

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

Here's another clue, as you appeared to have missed the school day when they talked about fractions:

What are you assigning the result of the TRUNCATE function to, when you finally get it working?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mapa
PostPosted: Thu Aug 11, 2011 2:22 pm    Post subject: Reply with quote

Master

Joined: 09 Aug 2001
Posts: 257
Location: Malmö, Sweden

Perhaps also take a look into the other message domains for xml.

XML is deprecated, use XMLNSC instead (or XMLNS if you must).

And if you look in the Information Center for the WMB there is actually a lot of ESQL code examples of casting between different datatypes.
_________________
Brgds, Magnus Palmér
Enfo Zystems
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Thu Aug 11, 2011 4:57 pm    Post subject: Reply with quote

Grand High Poobah

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

mapa wrote:
XML is deprecated, use XMLNSC instead (or XMLNS if you must).




But given the nature of the problem I feared this would just confuse the OP.
_________________
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 » Truncate function - esql
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.