September 13, 2000

Use Decode Function for Oracle Queries

Decode is a very useful and handy function for Oracle queries. Itreplaces the complex If-Then-Else logic, which is used to display different things based on different values in a column. Consider the following example in which the Viewable column can have values of 1,2, and 3: SELECT FirstName, ViewableFROM employee;Results:FIRSTNAME