Last active
December 12, 2015 06:28
-
-
Save maartenl/4728930 to your computer and use it in GitHub Desktop.
Transformation of DECODE to CASE - Example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- provides percentage taxation | |
DECODE(tax_notice.taxtype ,'VAT',NVL(tax.vat, tax.general) | |
,'PROP',NVL(tax.property_tax, tax.general) | |
,'INC',NVL(tax.income_tax, tax.general) | |
,'TAR',NVL(tax.tariff, tax.general) | |
,tax.general) | |
-- changed to | |
CASE tax_notice.taxtype | |
WHEN 'VAT' THEN COALESCE(tax.vat, tax.general) | |
WHEN 'PROP' THEN COALESCE(tax.property_tax, tax.general) | |
WHEN 'INC' THEN COALESCE(tax.income_tax, tax.general) | |
WHEN 'TAR' THEN COALESCE(tax.tariff, tax.general) | |
ELSE tax.general | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment