執行SQL時 報錯 ORA-01476:divisor is equal to zero 的解決方法
這個報錯,是因為除數為0,可以將除數轉換成非零的整數值
如下面SQL中的紅色部分
with tmp as
(select paycode, transtate, count(1) cnt_1
from elmp_trans_orderinfo
where createtime >= sysdate- 1 / (24 * 12)
and
trantype = 1
group by paycode, transtate)
select channel,case when cnt like '%.%' then to_char(cnt)||'%' else to_char(cnt) end cnt from
(select 'CMB_SUCCESS' channel, nvl(max(case when paycode = '1308' and transtate = 0 then cnt_1 end), 0) cnt
from tmp
union all
select 'CMB_TBD', nvl(max(case when paycode = '1308' and transtate = 2 then cnt_1 end), 0) cnt
from tmp
union all
select 'CMB_FAIL', nvl(max(case when paycode = '1308' and transtate = 1 then cnt_1 end), 0) cnt
from tmp
union all
select 'CMB_SUCCESS_RATIO', round(nvl(max(case when paycode = '1308' and transtate = 0 then cnt_1 end), 0) * 100 /
decode((nvl(max(case when paycode = '1308' and transtate = 0 then cnt_1 end), 0) + nvl(max(case when paycode = '1308' and transtate = 2 then
cnt_1 end), 0) + nvl(max(case when paycode = '1308' and transtate = 1 then cnt_1 end), 0)),0,1), 2)
from tmp
);
如下面SQL中的紅色部分
with tmp as
(select paycode, transtate, count(1) cnt_1
from elmp_trans_orderinfo
where createtime >= sysdate- 1 / (24 * 12)
and
trantype = 1
group by paycode, transtate)
select channel,case when cnt like '%.%' then to_char(cnt)||'%' else to_char(cnt) end cnt from
(select 'CMB_SUCCESS' channel, nvl(max(case when paycode = '1308' and transtate = 0 then cnt_1 end), 0) cnt
from tmp
union all
select 'CMB_TBD', nvl(max(case when paycode = '1308' and transtate = 2 then cnt_1 end), 0) cnt
from tmp
union all
select 'CMB_FAIL', nvl(max(case when paycode = '1308' and transtate = 1 then cnt_1 end), 0) cnt
from tmp
union all
select 'CMB_SUCCESS_RATIO', round(nvl(max(case when paycode = '1308' and transtate = 0 then cnt_1 end), 0) * 100 /
decode((nvl(max(case when paycode = '1308' and transtate = 0 then cnt_1 end), 0) + nvl(max(case when paycode = '1308' and transtate = 2 then
cnt_1 end), 0) + nvl(max(case when paycode = '1308' and transtate = 1 then cnt_1 end), 0)),0,1), 2)
from tmp
);
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-1824320/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Excel宏執行時提示錯誤1004的三個解決方法Excel
- idea執行java專案main方法報build failure錯誤的解決方法IdeaJavaAIUI
- spark-submit執行jar包報錯找不到類的解決方法SparkMITJAR
- 執行 PHP artisan migrate 時報長度錯誤的解決辦法?PHP
- Lumen 實時記錄 SQL 執行解決方案SQL
- sqlplus執行sql檔案報錯SQL
- Laravel Mix執行時關於es2015報錯解決方案Laravel
- mydumper執行報錯遇到缺失libssl.so.1.1問題的解決方法
- win10執行戰地3彈出directx function報錯的解決方法Win10Function
- Docker Hello World容器執行報錯的解決辦法Docker
- npm 執行時報錯“因為在此係統上禁止執行指令碼”解決辦法NPM指令碼
- yii執行phpunit時報錯PHP
- docker pull下載映象時的報錯及其解決方法Docker
- Windows 使用者執行 NPM run watch-poll 報錯的原因及解決方法WindowsNPM
- Laravel Mix - 執行 NPM install 報錯解決辦法LaravelNPM
- dbfread報錯ValueError錯誤解決方法Error
- hive使用報錯解決方法Hive
- 解決因對EFCore執行SQL方法不熟練而引起的問題SQL
- 關於 Composer dump-autoload 執行報錯解決方案
- 應用儲存過程執行報錯解決方案儲存過程
- Larabel遷移檔案時報SQLSTATE[42000]錯誤的解決方法SQL
- Mybatis批量更新SQL報錯☞解決辦法MyBatisSQL
- 誰遇到過執行 monkey 的時候報 filenotfound 的報錯
- 執行 brew install 命令長時間卡在 Updating Homebrew 的解決方法
- win10系統執行CSGO時藍屏的解決方法Win10Go
- oracle查詢sql執行耗時、執行時間、sql_idOracleSQL
- 電腦開機時報錯No Bootable Device找不到索引的解決方法bootdev索引
- 多執行緒併發執行及解決方法執行緒
- AS執行main()方法報錯:SourceSet with name ‘main‘ not foundAI
- Nginx報504 gateway timeout錯誤的解決方法NginxGateway
- 下載HuggingFace模型的方法以及報錯解決模型
- win10執行jade提示399錯誤怎麼辦_win10執行jade提示399錯誤的解決方法Win10
- ceph叢集安裝報錯解決方法
- Django2.2 報錯:UnicodeDecodeError 解決方法DjangoUnicodeError
- SQL Server 匯出Excel有換行的解決方法SQLServerExcel
- Laravel 5.4 Mix執行 npm run dev時報錯,提示cross-env not found的原因及解決辦法LaravelNPMdevROS
- Android Studio 中使用switch語句時報錯Constant expression required的解決方法AndroidExpressUI
- npm publish 釋出一個 Angular 庫的時候報錯以及解決方法NPMAngular
- 執行Tensorboard出現kernel is dead的解決方法ORB