In the above query 10 is the expression that is trying search for matching expression in the decode function.If comparison value of expression not matches with any other expression then it results default value as output.Decode functions compare the expression with other expressions like search1, search2, … searchN till the expression matches with other expression and returns the result that matches with expression.SELECT DECODE(10,50,20,30) result FROM DUAL resultĭECODE(expression,search1, result1, search2, result2,…., searchN, resultN, default) SELECT DECODE(10,10,20,30) result FROM DUAL If expr1 equals to expr2 then decode functions returns Result 1 otherwise Result 2 as output. Syntax: DECODE(expr1,expr2,result 1, result2) DECODE function cannot call directly with in PL-SQL block.and in insertion statement when try to insert values into a table Decode can also use with where condition in select, update and Delete statements.Select query can be used with in decode function.DECODE considers two nulls to be equivalent. ![]() DECODE result type is first decoded expression type, all others are. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |