SQL functions

Monday, March 16th, 2009

DECODE Decode function has the functionality of an IF-THEN-ELSE statement. Decode does a value-by-value substitution. For every value that is given in the DECODE function it makes if then check and matches the value. Syntax-Decode (Value, if-search-1,result1,if-search-2,result2,if-search-3,result3,if-search-1,default-result) Example select empname,Decode(empid,1001,20000,1002,12000,1003,15000,null) from emp; This query is selecting the emp name and salary on basis of emp [...] Read more »

  • Delicious
  • Yahoo Buzz
  • Digg
  • DZone
  • Facebook
  • LinkedIn
  • Twitter
  • Share/Bookmark