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 » Working with Integer data type

Post new topic  Reply to topic
 Working with Integer data type « View previous topic :: View next topic » 
Author Message
datspats
PostPosted: Sun May 06, 2007 9:37 pm    Post subject: Working with Integer data type Reply with quote

Voyager

Joined: 12 Apr 2007
Posts: 80
Location: Mumbai

Hi,

I am getting integer from DB and storing this to an integer variable in eSQL.
But i need fixed size of the integer say 5,
e.g. If the op from db is 23, I need this to be 00023
or if the op from db is 2345, then i need 02345.

I tried assigning to decimal(5,0), but leading zeros are always trimmed out, Is there any ways apart from manually prefixing zeros as string?

regards,
Back to top
View user's profile Send private message Yahoo Messenger
Mensch
PostPosted: Sun May 06, 2007 9:58 pm    Post subject: Reply with quote

Disciple

Joined: 17 Jul 2005
Posts: 166

Best way is to write ESQL code depending upon length of the field that you are fetching from database.
OR

if you are using TDS messages, in physical properties of elements
select
Justification as "Right Justify" and Padding character as "'0'"

not sure about second option but you can give it a try

_________________
Thanks and Regards ,
Mensch
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Sun May 06, 2007 11:16 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi datspats,

Not tested
Code:
RIGHT('00000' || fieldValue, 5)

Regards.
Back to top
View user's profile Send private message Send e-mail
AkankshA
PostPosted: Mon May 07, 2007 12:39 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

elvis.. it would work

The fieldValue variable must be be of the CHARACTER and aso don forget to cast the o/p back to integer
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
datspats
PostPosted: Mon May 07, 2007 9:58 pm    Post subject: Reply with quote

Voyager

Joined: 12 Apr 2007
Posts: 80
Location: Mumbai

Hi elvis,

Thanks for solution, that worked and this need to be casted back to int

regards
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Working with Integer data type
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.