computer
 






 

Question by  girIbot (26)

What does decode do in SQL?

 
+7

Answer by  zombieguy (986)

With a given expression (expr), decode will compare it to the given search values one by one in turn. When it finds an expr equal to a search, it returns a given result; if no result is specified, it returns a default value.

 
+7

Answer by  hsf (35)

The Decode function in SQL performs an If-Then-Else logic process based on the set of variables passed to the function, in a single SQL statement.

 
+7

Answer by  DrHarris (508)

It is an easier way to express a series of conditional statements that connect a key to a value. For the syntax DECODE(expression, [key1, value1], [key2, value2], ...) it compares the expression to each key. If the expression is equal to key1, it returns value1, and so on.

 
+6

Answer by  MarvinFVicarme (132)

performs an If-Then-Else logic process based on the set of variables passed to the function, in a single SQL statement. It can also do several searches and compare them to each other. If no matches are found in the search it will go back to default.

 
+6

Answer by  BigD103 (548)

I know in Oracle databases that the decode function works like an "If-Then-Else" statement. It is used to compare expressions one by one.

 
+6

Answer by  Sting1 (686)

An example: DECODE (expr,search1,result1[,search2,result2]... [,default_val]); The function DECODE in this case compares expr to every search(search1,search2... ) value one by one. If "expr" is equal to a "search1", then it returns "result1" else it compares "expr" to "search2" and so on. If no match is found, then "default_val" will be returned instead.

 
+5

Answer by  Jalaine11 (2043)

What decode does in SQL is compares expressions to each search. It will do several searches and compare them to each other. If no matches are found in the search it will go back to default.

 
+5

Answer by  Bobby50 (82)

Decode compares expression to the search-x expression and if matches, return the result, if not it will give the default answer.

 
+5

Answer by  tjh1234 (362)

A built-in function which acts as an IF-THEN-ELSE - the first parameter is compared against the provided search terms and the corresponding result parameter is returned if they matched correctly.

 
+4

Answer by  murali680 (559)

Decode are mainly used in SQL is to compare expressions single by single. It has process as 'IF-THEN-ELSE 'which is working based on the combination of variables passed to the function in SQL statement. These functions are from oracle data base. If there is no matching found it will return back to default position.

 
You have 50 words left!