23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

DECODE<br />

DECODE<br />

Syntax<br />

94<br />

Compares the value of the first argument expression with each search_expression and, if a<br />

match is found, returns the corresponding match_expression. If no match is found, then the<br />

function returns the default_expression. If a default_expression is not specified and no<br />

match is found, then the function returns a NULL value.<br />

Example This example illustrates one way to use the DECODE function:<br />

Notes • Use a simple case expression when <strong>SQL</strong>-compatible syntax is a requirement.<br />

DEGREES<br />

Syntax<br />

DECODE ( expression, search_expression, match_expression<br />

[ , search_expression, match_expression ...]<br />

[ , default_expression ] )<br />

SELECT ename, DECODE (deptno,<br />

10, 'ACCOUNTS',<br />

20, 'RESEARCH',<br />

30, 'SALES',<br />

40, 'SUPPORT',<br />

'NOT ASSIGNED'<br />

)<br />

FROM employee ;<br />

• The first argument expression can be of any type. The types of all search_expressions<br />

must be compatible with the type of the first argument.<br />

• The match_expressions can be of any type. The types of all match_expressions must be<br />

compatible with the type of the first match_expression.<br />

• The type of the default_expression must be compatible with the type of the first<br />

match_expression.<br />

• The type of the result is the same as that of the first match_expression.<br />

• If the first argument expression is NULL, then the value of the default_expression is<br />

returned, if it is specified. Otherwise NULL is returned.<br />

Compatibility<br />

Progress extension<br />

Returns the number of degrees in an angle specified in radians by expression.<br />

DEGREES ( expression )

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!