简体   繁体   English

Oracle SQL:在int中的特定位置插入小数

[英]Oracle SQL: Inserting a decimal into a specific location in an int

This seems like a very straightforward question but for some reason my mind is not there: 这似乎是一个非常简单的问题,但是由于某种原因,我的想法不存在:

I am loading numbers into an oracle db. 我正在将数字加载到oracle数据库中。 They are n digits in length and are all whole numbers ie 38495. I know from the file format that this number does not represent 38495 but instead 384.95 它们是n位数字,并且都是整数,即38495。我从文件格式中知道,该数字不代表38495,而是384.95。

How to I insert the decimal two digits to the left of the right most digit? 如何在最右边的数字的左侧插入小数点后两位数字?

When I do this: 当我这样做时:

select to_char(to_number('38495'),'999.99') from dual; 从双中选择to_char(to_number('38495'),'999.99');

My result is this: 我的结果是这样的:

#######

Do I really need to substring this value? 我真的需要对这个值进行子串化吗? It seems like there should be a more elegant solution. 似乎应该有一个更优雅的解决方案。

将整数除以100.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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