我的oracle数据库中有一个数字4000,我必须将其转换为20.00并将其插入另一个。请帮助我如何使用oracle查询执行此操作。
答案 0 :(得分:2)
您在下面找到了什么
public class DerivedMain {
int data = 10;
@Override
public int hashCode() {
return data;
}
public static void main(String[] args) {
HashMap m = new HashMap();
for(int i=0;i<20;i++) {
m.put(i, i);
}
Field tableField = null;
try {
tableField = HashMap.class.getDeclaredField("table");
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tableField.setAccessible(true);
Object[] table = null;
try {
table = (Object[]) tableField.get(m);
} catch (IllegalArgumentException | IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(table == null ? 0 : table.length);
}
答案 1 :(得分:0)
要保留小数点,看起来目标列的数据类型为VARCHAR2
,这意味着TO_CHAR
函数(以及适当的格式掩码)可能会有所帮助。这是一个示例:
SQL> create table source (num number);
Table created.
SQL> insert into source (num)
2 select 2000 from dual union all
3 select 400 from dual union all
4 select 5 from dual;
3 rows created.
SQL> create table target (cchar varchar2(20));
Table created.
SQL> insert into target (cchar)
2 select to_char(num/100, '999G990D00')
3 from source;
3 rows created.
SQL> select * from target;
CCHAR
--------------------
20,00
4,00
0,05
SQL>