这是我的查询。我得到的结果是19
SQL> SELECT TRUNC(19.00,1) FROM DUAL;
TRUNC(19.00,1)
19
相反,我需要结果19.0
,我将如何做到这一点?
As you appear to be using SQL*Plus you can format the column output directly:
SQL> COLUMN target FORMAT 09.9
SQL> SELECT TRUNC(19.00, 1) AS target FROM dual;
TARGET
------
19.0
Voila...
Otherwise you would need to either set your IDE to dispaly numerics with a trailing decimal place or display it as a VARCHAR2:
SELECT TO_CHAR(TRUNC(19.00, 1), '09.9')
FROM dual;
Hope it helps...
select to_char(19, '09.9') from dual;
请参阅数字格式模型
我想这也应该工作
SELECT TO_CHAR(TRUNC(19.00, 1),'00.9') FROM dual;