Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 在不同列中拆分金额 id金额 1 4502,52 2 1500 3 2343,24 4 234,05_Sql_Split - Fatal编程技术网

Sql 在不同列中拆分金额 id金额 1 4502,52 2 1500 3 2343,24 4 234,05

Sql 在不同列中拆分金额 id金额 1 4502,52 2 1500 3 2343,24 4 234,05,sql,split,Sql,Split,我想用一列欧元金额拆分金额,一列美分: id金额欧元分 1 4502,52 4502 52 2 1500 1500 0 3 2343,24 2343 24 考虑到金额是数字字段: select id, amount, trunc(amount) as euro, sign(amount)*(amount - trunc(amount))*100 as cent from dual; 干杯 金额列的数据类型是什么?另外,请提供您正在使用的当前查询(

我想用一列欧元金额拆分金额,一列美分:

id金额欧元分
1   4502,52   4502   52
2   1500      1500    0
3   2343,24   2343   24

考虑到金额是数字字段:

select id, amount, trunc(amount) as euro, 
sign(amount)*(amount - trunc(amount))*100 as cent from dual; 

干杯

金额
列的数据类型是什么?另外,请提供您正在使用的当前查询(SELECT、tablename等)。答案将以更新查询的形式给出。