Thursday, September 4, 2008

Decode

Decode is a sql function that provides similar functionality to an if then else or case statement. SELECT decode(sex, 'M', 'Male', 'F', 'Female', 'Unknown') FROM employees;default is optional. If no matches are found, the decode will return default. If default is omitted, then the decode statement will return NULL (no matches found).

No comments: