Pythontr

husonet | Tarih: 17.04.2024

Oracle Case Kullanımına Örnek

Select içinde oracleda case kullanımı örneği

Select  AIR_ALS_ANA_HSIRKET AS HAVA_SIRKETI,
(Case
When :CHRQ_WEIGHT >= 45 and :CHRQ_WEIGHT < 100 then 45
When :CHRQ_WEIGHT >= 100 and :CHRQ_WEIGHT < 200 then 100
When :CHRQ_WEIGHT >= 200 and :CHRQ_WEIGHT < 250 then 200
When :CHRQ_WEIGHT >= 250 and :CHRQ_WEIGHT < 300 then 250
When :CHRQ_WEIGHT >= 300 and :CHRQ_WEIGHT < 500 then 300
When :CHRQ_WEIGHT >= 500 and :CHRQ_WEIGHT < 1000 then 500
When :CHRQ_WEIGHT >= 1000 and :CHRQ_WEIGHT < 1500 then 1000
When :CHRQ_WEIGHT >= 1500 and :CHRQ_WEIGHT < 2000 then 1500
When :CHRQ_WEIGHT >= 2000 and :CHRQ_WEIGHT < 2500 then 2000
When :CHRQ_WEIGHT >= 2500 and :CHRQ_WEIGHT < 3000 then 2500
When :CHRQ_WEIGHT >= 3000 and :CHRQ_WEIGHT < 5000 then 3000
When :CHRQ_WEIGHT >= 5000 then 5000
else 0 end) as BAREM,
(Case
When :CHRQ_WEIGHT >= 45 and :CHRQ_WEIGHT < 100 then AIR_ALS_DET_45
When :CHRQ_WEIGHT >= 100 and :CHRQ_WEIGHT < 200 then AIR_ALS_DET_100
When :CHRQ_WEIGHT >= 200 and :CHRQ_WEIGHT < 250 then AIR_ALS_DET_200
When :CHRQ_WEIGHT >= 250 and :CHRQ_WEIGHT < 300 then AIR_ALS_DET_250
When :CHRQ_WEIGHT >= 300 and :CHRQ_WEIGHT < 500 then AIR_ALS_DET_300
When :CHRQ_WEIGHT >= 500 and :CHRQ_WEIGHT < 1000 then AIR_ALS_DET_500
When :CHRQ_WEIGHT >= 1000 and :CHRQ_WEIGHT < 1500 then AIR_ALS_DET_1000
When :CHRQ_WEIGHT >= 1500 and :CHRQ_WEIGHT < 2000 then AIR_ALS_DET_1500
When :CHRQ_WEIGHT >= 2000 and :CHRQ_WEIGHT < 2500 then AIR_ALS_DET_2000
When :CHRQ_WEIGHT >= 2500 and :CHRQ_WEIGHT < 3000 then AIR_ALS_DET_2500
When :CHRQ_WEIGHT >= 3000 and :CHRQ_WEIGHT < 5000 then AIR_ALS_DET_3000
When :CHRQ_WEIGHT >= 5000 then AIR_ALS_DET_5000
else 0 end) as RATE,
(Case
When :CHRQ_WEIGHT >= 45 and :CHRQ_WEIGHT < 100 then AIR_ALS_DET_45 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 100 and :CHRQ_WEIGHT < 200 then AIR_ALS_DET_100 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 200 and :CHRQ_WEIGHT < 250 then AIR_ALS_DET_200 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 250 and :CHRQ_WEIGHT < 300 then AIR_ALS_DET_250 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 300 and :CHRQ_WEIGHT < 500 then AIR_ALS_DET_300 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 500 and :CHRQ_WEIGHT < 1000 then AIR_ALS_DET_500 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 1000 and :CHRQ_WEIGHT < 1500 then AIR_ALS_DET_1000 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 1500 and :CHRQ_WEIGHT < 2000 then AIR_ALS_DET_1500 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 2000 and :CHRQ_WEIGHT < 2500 then AIR_ALS_DET_2000 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 2500 and :CHRQ_WEIGHT < 3000 then AIR_ALS_DET_2500 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 3000 and :CHRQ_WEIGHT < 5000 then AIR_ALS_DET_3000 * :CHRQ_WEIGHT
When :CHRQ_WEIGHT >= 5000 then AIR_ALS_DET_5000 * :CHRQ_WEIGHT
else 0 end) as NAVLUN,
AIR_ALS_ANA.*
from AIR_ALS_ANA
JOIN AIR_ALS_DET ON AIR_ALS_ANA.AIR_ALS_ANA_RECNO = AIR_ALS_DET.AIR_ALS_ANA_RECNO
where AIR_ALS_ANA.AIR_ALS_ANA_HSIRKET = 'TK'