0
如何將字符串轉換爲雙精度或小數?在Exact Online(REST API)中,我嘗試使用字符串字段中的十進制值進行計算。例如items.netprice + items.notes
。字段items.notes
包含十進制值。 試用cast
和convert
結合float
和decimal
。字符串加倍或小數
如何將字符串轉換爲雙精度或小數?在Exact Online(REST API)中,我嘗試使用字符串字段中的十進制值進行計算。例如items.netprice + items.notes
。字段items.notes
包含十進制值。 試用cast
和convert
結合float
和decimal
。字符串加倍或小數
我會用類似的解決方案:
select case
when regexp_replace(c, '[^0-9.]', '', 1, 0, 'g') = c
then to_number(c)
else null
end
from (select '123.45' c
from [email protected]
union all
select '123invalid.45' c
from [email protected]
)
的case
有regexp_replace
確保非數量爲空返回。如果認爲有必要,您可能需要將其更改爲錯誤。
目前尚不清楚你在做什麼。你能證明你給的東西到目前爲止嗎? –