以货币格式填写数字

时间:2015-05-05 19:41:21

标签: sql oracle

我需要将 varchar 中的字段转换为数字类型。

该值的格式为$ 999,999.99,但也可能为空。

我试过这个但是它似乎无法正常工作

to_number(nvl(MYFIELD, '$0.00'),'FM$999,999,999,990.00')

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您可以尝试这样:

select to_number(nvl('$119,252.75', '$0.00'),'FM$999,999,999,990.00') from dual

<强> SQL FIDDLE DEMO

此外,您的查询对我来说还不错

#include<iostream>

using namespace std;


int main()
{
    int arrows[1] = { 23 }; // initialize array of size one and assign it value 23
    // sizeof(arrows)/sizeof(*arrows) calculates the length of an array
    // iterate through all elements of the array and display their values..
    for (int i = 0; i < sizeof(arrows) / sizeof(*arrows); i++)
    {
        cout << arrows[i];
    }
    return 0;
}

<强> SQL FIDDLE DEMO

相关问题