+ 3

How to use DECODE function in SQL ?

Its used for conditional processing, please provide some example.

19th Jul 2016, 8:28 AM
Ashutosh Singh
1 Resposta
+ 5
SELECT manufact_name, DECODE (manufact_id, 1000, 'BMW', 1001, 'AUDI', 1002, 'CHEVROLET') result from manufaturers; will return BMW if manufat_id is 1000 and CHEVROLET if manufact_id is 1002. This can be used to avoid if - elsif ladder
20th Jul 2016, 3:50 PM
sreeraj g
sreeraj g - avatar