|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
[Solved]CAST CHAR to DECIMAL |
« View previous topic :: View next topic » |
Author |
Message
|
billybong |
Posted: Thu Apr 19, 2007 8:25 am Post subject: [Solved]CAST CHAR to DECIMAL |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
Hi all!
Could someone have a look at this and advice me why this does not work?
DECLARE price_pattern CHARACTER '#.##0,00';
SET OutputRoot.MRM.products.item[i].price = CAST('64,34' AS DECIMAL FORMAT price_pattern DEFAULT 0.00);
The price element becomes the default value, I've tried changing it to confirm it.
Is something wrong with my pattern? _________________ IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Integration Developer V6.0
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere DataPower
Last edited by billybong on Fri Apr 20, 2007 12:49 am; edited 1 time in total |
|
Back to top |
|
 |
vsr |
Posted: Thu Apr 19, 2007 10:09 am Post subject: |
|
|
Centurion
Joined: 04 Apr 2006 Posts: 104
|
It should work if you use colan after DEFAULT in your statement. That is DEFAULT '0.00' instead of DEFAULT 0.00 .
We should cast the same types , here CHARACTER .
0.00 is of type DECIMAL not CHARACTER .
Apart from that your statement if OK to me ! |
|
Back to top |
|
 |
billybong |
Posted: Thu Apr 19, 2007 11:41 pm Post subject: |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
Thanks for your quick answer, even though it was a wrong one.
The default value must be of the same type as the datatype you are casting TO, since no casting is done if the default value is used as a resort instead of throwing an exception. The default value should never fail, and does not use the pattern specified.
I'm still having problems with this, anyone who sees something I've missed?
According to the exception list created if I omit the default value the cast complains about a "grouping separator after decimal".
Could this have something to do with the fact that '#,##0.00' is a more recoqnized pattern than my '#.##0,00' ?
Code: |
[Exception List]
(
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S600_P\src\DataFlowEngine\PluginInterface\ImbJniNode.cpp'
(0x03000000):Line = 926
(0x03000000):Function = 'ImbJniNode::evaluate'
(0x03000000):Type = 'ComIbmJniNode'
(0x03000000):Name = 'EnjoyITPriceParserMsgFlow#FCMComposite_1_1'
(0x03000000):Label = 'EnjoyITPriceParserMsgFlow.magirus'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2230
(0x03000000):Text = 'Caught exception and rethrowing'
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S600_P\src\DataFlowEngine\ImbComputeNode.cpp'
(0x03000000):Line = 464
(0x03000000):Function = 'ImbComputeNode::evaluate'
(0x03000000):Type = 'ComIbmComputeNode'
(0x03000000):Name = 'EnjoyITPriceParserMsgFlow#FCMComposite_1_5'
(0x03000000):Label = 'EnjoyITPriceParserMsgFlow.TransformToEnjoyItList'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2230
(0x03000000):Text = 'Caught exception and rethrowing'
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S600_P\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp'
(0x03000000):Line = 589
(0x03000000):Function = 'SqlStatementGroup::execute'
(0x03000000):Type = 'ComIbmComputeNode'
(0x03000000):Name = 'EnjoyITPriceParserMsgFlow#FCMComposite_1_5'
(0x03000000):Label = 'EnjoyITPriceParserMsgFlow.TransformToEnjoyItList'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2488
(0x03000000):Text = 'Error detected, rethrowing'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '.EnjoyITPriceParserMsgFlow_TransformToEnjoyItList.Main'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '4.3'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'MapMagirusToEnjoyIT();'
)
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S600_P\src\DataFlowEngine\ImbRdl\ImbRdlRoutine.cpp'
(0x03000000):Line = 548
(0x03000000):Function = 'SqlRoutine::invoke'
(0x03000000):Type = 'ComIbmComputeNode'
(0x03000000):Name = 'EnjoyITPriceParserMsgFlow#FCMComposite_1_5'
(0x03000000):Label = 'EnjoyITPriceParserMsgFlow.TransformToEnjoyItList'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2934
(0x03000000):Text = 'Error occured in procedure'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'MapMagirusToEnjoyIT'
)
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S600_P\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp'
(0x03000000):Line = 589
(0x03000000):Function = 'SqlStatementGroup::execute'
(0x03000000):Type = 'ComIbmComputeNode'
(0x03000000):Name = 'EnjoyITPriceParserMsgFlow#FCMComposite_1_5'
(0x03000000):Label = 'EnjoyITPriceParserMsgFlow.TransformToEnjoyItList'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2488
(0x03000000):Text = 'Error detected, rethrowing'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '.EnjoyITPriceParserMsgFlow_TransformToEnjoyItList.MapMagirusToEnjoyIT'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '26.5'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'SET OutputRoot.MRM.products.item[i].price = CAST('64,34' AS DECIMAL FORMAT price_pattern);'
)
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S600_P\src\DataFlowEngine\ImbRdl\ImbRdlTypeCast.cpp'
(0x03000000):Line = 257
(0x03000000):Function = 'SqlTypeCast::evaluate'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2521
(0x03000000):Text = 'Error while casting'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '.EnjoyITPriceParserMsgFlow_TransformToEnjoyItList.MapMagirusToEnjoyIT'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '26.49'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = ''64,34''
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'DECIMAL'
)
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S600_P\src\CommonServices\ImbNumberFormatter.cpp'
(0x03000000):Line = 427
(0x03000000):Function = 'ImbNumberFormatter::parsePattern'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 3207
(0x03000000):Text = 'grouping separator after decimal'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '#.##0,00'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = ','
)
)
)
)
)
)
)
)
)
|
_________________ IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Integration Developer V6.0
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere DataPower |
|
Back to top |
|
 |
billybong |
Posted: Fri Apr 20, 2007 12:47 am Post subject: |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
Solved it!
The pattern was:
Code: |
DECLARE price_pattern CHARACTER ###,###,##0.00:groupsep=.:decsep=,'; |
Since my group and decimal separators are reversed I had to point them out in the pattern.
Didn't see anything about the groupsep and decsep except in one (!) example code which didnt even explain anything about them. _________________ IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Integration Developer V6.0
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere DataPower |
|
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
|
|
|
|