如何使用informatica中的表达式转换将字符串转换为数字?
我有数据类型为字符串的源列(金额),包含类似 $793.00、$5791.00 等数据,...
我需要将相同的数据加载到数据类型为 NUMBER 的目标表列(金额)中,
如何使用“$ 获取相同的数据” ' 通过使用 informatica 中的表达式转换在目标中添加符号?
请任何人帮助我,提前致谢。
I have source column(amount) with datatype string, contains the datas like $793.00, $5791.00,...
I need to load this same data into the target table column(amount) with datatype NUMBER
how can i get this same data with '$' symbol in target by using expression transformation in informatica?
anyone help me please, thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
TO_NUMBER(SUBSTR(AMOUNT,INSTR(AMOUNT,'$')+1,LENGTH(AMOUNT)-1))
或者如果它始终是第一个字符并且您不必担心空格
TO_NUMBER(SUBSTR(AMOUNT,2,长度(数量)-1))
TO_NUMBER(SUBSTR(AMOUNT,INSTR(AMOUNT,'$')+1,LENGTH(AMOUNT)-1))
or if it's always the first character and you don't have to worry about spaces
TO_NUMBER(SUBSTR(AMOUNT,2,LENGTH(AMOUNT)-1))
您可以将源列“金额”放入一个表达式元素中,例如“AMOUNT_INPUT”,然后在该表达式中添加一项新项目,这样“AMOUNT_OUTPUT”在此将表达式设置为“TO_NUMBER(AMOUNT_INPUT) )”
You can take source column "amount" into one expression element, say "AMOUNT_INPUT" and add a new item in that expression such that "AMOUNT_OUTPUT" in this make a expression as "TO_NUMBER(AMOUNT_INPUT)"
某些版本的 Informatica 不支持
TO_NUMBER()
。如果您使用的版本属于这种情况,您将需要根据您的用例使用以下其中一项:TO_INTEGER()
TO_FLOAT()
请参阅参考Informatica 函数 了解使用详细信息。
Some versions of Informatica do not support
TO_NUMBER()
. If that is the case with the version you are using, you will need to use one of the following, as appropriate for your use case:TO_INTEGER()
TO_FLOAT()
TO_DECIMAL()
See the reference of Informatica functions for usage details.
您还可以使用以下逻辑来获得所需的结果 -
REPLACESTR(1,金额,'$','')
You can also use below logic to get the desired result -
REPLACESTR(1,AMOUNT,'$','')