restsurvival.blogg.se

Decode sql
Decode sql













decode sql

We have limited functionality in decode as the decode function only uses the scalar values.Oracle overcomes this in case statement and case statement can work with the sub-queries as well as searchable values.Ĭase when Employee_name in (‘Amit’,’Pradnya’,’Rahul’) then ‘Management People’ /*This is In predicate*/ 2.Case statement can work with sub-queries and predicates as well Here you can see that we have used the greater than and other operators. The above query will give us information about the Class of Employee.

decode sql

The Case statement is capable of using other operators as well rather than equal to operator.Ĭase When Salary > 10000 and Salary =20000 then ‘Class-1’ The Decode function is used to perform only equality condition. ‘Others’ As ‘Gender’ from Employee Difference between Decode and Case statement with real examples 1.Case Statement is working with other logical operators except ‘=’ equal to operator This feature will be used to improve the performance of query.Ĥ.Oracle started the decode functions in its oracle 9i version but they have defined the different functionality of case statement where they have added the decode functionalities and more functionalities than decode in CASE Statement.ĭecode (Column_name, Value_1, Mapping_1,Value_2,Mapping_2….Value_N,Mapping_N) If Variable = Value1 then Value/variable/statementĮlse if Variable= Value2 then Value/variable/statementģ.Both Decode as well as Case statement allows us to create the indexes on the multiple columns which are not exists in the database. Decode,Case Function with Syntax and usagesĭecode Statement is faster than Case Statement when it passes from optimizer Decode, Case Function with Syntax and usages :ġ.Both oracle function and oracle case functions are important functions which are used to transform the values from single value to another separate value.Ģ.The Oracle as well as Oracle case statement will give us the transformation of values in following format.In my previous article i have given the many examples of difference between technically.In this article i would like to throw light on Difference between Decode and Case statement with multiple real life scenarios.The short form of if.else is Oracle case or decode statement in oracle.















Decode sql