我的值为33.75,48.75和26.25
那么如何才能将它们显示为34,49和26?
SQL> SELECT p.price "Price in SAR"
2 FROM payment p;
Price in SAR
------------
49
49
34
26
26
26
34
49
答案 0 :(得分:0)
我怀疑这是由于该列的数据类型:
https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT313
create table t1 (col1 number (5));
insert into t1 values (33.75);
insert into t1 values (48.75);
insert into t1 values (26.25);
insert into t1 values (10.50);
create table t2 (col1 number (5,2));
insert into t2 values (33.75);
insert into t2 values (48.75);
insert into t2 values (26.25);
insert into t2 values (10.50);
select * from t1;
COL1
----------
34
49
26
11
SQL> select * from t2;
COL1
----------
33.75
48.75
26.25
10.5
SQL> select to_char(col1, '99.99') from t2;
TO_CHA
------
33.75
48.75
26.25
10.50