Progress
SQL-92
Guide and Reference


DECODE Function

Compares the value of the first argument expression with each search_expression and, if a match is found, returns the corresponding match_expression. If no match is found, then the function returns the default_expression. If a default_expression is not specified and no match is found, the function returns a null value.

SYNTAX

DECODE ( expression, search_expression, match_expression
   [ , search_expression, match_expression ...]
   [ , default_expression ] ) 

EXAMPLE

This example illustrates one way to use the DECODE function:

SELECT ename, DECODE (deptno,
             10, ’ACCOUNTS  ’,
             20, ’RESEARCH  ’,
             30, ’SALES    ’,
             40, ’SUPPORT   ’,
             ’NOT ASSIGNED’
          )
   FROM employee ; 

NOTES

COMPATIBILITY

Progress Extension


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095