|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Checking for numeric values |
« View previous topic :: View next topic » |
Author |
Message
|
saturn_cemk |
Posted: Mon Apr 23, 2007 6:02 pm Post subject: Checking for numeric values |
|
|
Novice
Joined: 10 Jul 2006 Posts: 16
|
Hi,
I am trying to check whether a field (defined as character) in the input message has numeric value or not. There is no predefined function in ESQL to check this as far as I know. Can anyone suggest a good way for checking this ?
Thanks |
|
Back to top |
|
 |
sourdas2 |
Posted: Mon Apr 23, 2007 8:24 pm Post subject: |
|
|
 Voyager
Joined: 21 Apr 2006 Posts: 90 Location: Kolkata,India
|
MB 6 does not have such kinds of predefined function.
Though you can write an user defined function by calculating the length of the string and checking each character of string with each 0,1,2...9 and '.' (point). If checking is true, then it is a valid number. _________________ Thanks and Warm Regards
Sourav |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 23, 2007 9:30 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can cast it as a Number.
Then you can use SQLSTATE to check for ESQL exceptions. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
saturn_cemk |
Posted: Tue Apr 24, 2007 10:35 am Post subject: |
|
|
Novice
Joined: 10 Jul 2006 Posts: 16
|
Thank you Sourav and Jeff for your suggestions.
I tried both the solutions and both of them worked. Personally, I feel that the second approach is a better way of handling the case.
Thanks again. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|