简体   繁体   中英

Convert string with comma into number

I'm trying to sum XML attribute amount with values like 7819.3 and 156.90 with this query

SELECT J.NUMERO_ELETTRONICO, TO_NUMBER((SELECT * FROM XMLTABLE( xmlnamespaces('http://www.hp.com/best/next/trx' as "trx"),'sum(//trx:Contanti/trx:Taglio[@valoreNominale="0"]/@amount)' passing I.OPERATION_DOC )))

but I obtain results like this

93218214                                 8.0E+03

I tried using TO_NUMBER format attributes like these

TO_NUMBER('7,9761999999999998E+003','999999G99', 'NLS_NUMERIC_CHARACTERS=''.,''')

but I can't obtain 7.976 as number.

Can anyone help me ?

我用这个查询解决了

SELECT J.NUMERO_ELETTRONICO, TO_CHAR(TO_NUMBER((SELECT * FROM XMLTABLE( xmlnamespaces('http://www.hp.com/best/next/trx' as "trx"),'sum(//trx:Contanti/trx:Taglio[@valoreNominale="0"]/@amount)' passing I.OPERATION_DOC ))), '9999.99') AS 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