Progress
Embedded SQL-92
Guide and Reference
Using Scalar Functions
Scalar functions accept as arguments a collection of values derived from one or more columns corresponding to one row, from either a database table or an intermediate result table. Scalar functions return one value.
EXAMPLESThe following examples illustrate scalar functions in SQL statements:
The DECODE function accepts a column name, a column value, and its substitute value. Optionally, you can specify a default value. This example compares the deptno column to the department code, and returns the corresponding department name. If there is no match, the example returns the default string NOT ASSIGNED. The DECODE function is similar to the C Language switch statement.
You can use the NVL function to check whether a column value is NULL. If NULL, you can specify a substitute value to return. This example returns the substitute zero value if the commission column contains a NULL value:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |