select?dwdm||'%'?from?pubkszl?where?kjnd='2016'?and?length(trim?(dwdm))=3?and?dwdm='101'?order?by?dwdm
網(wǎng)站建設哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁設計、網(wǎng)站建設、微信開發(fā)、微信小程序開發(fā)、集團企業(yè)網(wǎng)站建設等服務項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了靖安免費建站歡迎大家使用!
先將數(shù)據(jù)轉換為numeric類型,保留4位小數(shù)點,由零點幾變?yōu)榘俜痔柷斑叺臄?shù)字,再轉換為varchar類型,然后再加'%'
如:
select ml as 毛利,sshje as 實收金額,
cast(cast(ml/sshje as numeric(4,4))*100 as varchar(20)) + '%' as 利潤率
from chasalldayhz
to_char(a/b*100,'fm999999990.999999999')||'%'
函數(shù):to_char(數(shù)字,格式),格式小數(shù)點前面一位是零。
以具有dba權限的用戶登錄,直接查詢
SELECT UPPER(F.TABLESPACE_NAME) "表空間名",
D.TOT_GROOTTE_MB "表空間大小(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空間(M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,
2),
'990.99')||'%' "使用比(%)",
F.TOTAL_BYTES "空閑空間(M)",
F.MAX_BYTES "最大塊(M)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY F.TABLESPACE_NAME;