简体   繁体   中英

How to convert string into number using expression transformation in 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.


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))

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.

您可以将源列“金额”放入一个表达式元素中,说“ AMOUNT_INPUT”,然后在该表达式中添加一个新项,以使其中的“ AMOUNT_OUTPUT”成为“ TO_NUMBER(AMOUNT_INPUT)”

您还可以使用以下逻辑来获得所需的结果-REPLACESTR(1,AMOUNT,'$','')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM