Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Other Syntax Segments >

Return Clause

The Return clause specifies the data type of a value or values that a user-defined function returns. You can use this segment in UDR definitions.

Syntax

Read syntax diagramSkip visual syntax diagramReturn Clause:
 
|--+-RETURNING------+------------------------------------------->
   |  (1)           |
   '--------RETURNS-'
 
                                    (2)
>--+-+-| Subset of SQL Data Types |------+--+----------------------+------------+--|
   | '-REFERENCES--+-BYTE-+--------------'  |  (1)                 |            |
   |               '-TEXT-'                 '--------AS--parameter-'            |
   |        .-,---------------------------------------------------------------. |
   |  (3)   V                                (2)                              | |
   '----------+-| Subset of SQL Data Types |------+--+----------------------+-+-'
              '-REFERENCES--+-BYTE-+--------------'  |  (1)                 |
                            '-TEXT-'                 '--------AS--parameter-'
 
Notes:
  1. Dynamic Server only
  2. See Subset of SQL Data Types
  3. Stored Procedure Language only

Element Description Restrictions Syntax
parameter Name that you declare here for a returned parameter of the UDR Must be unique among returned parameters of UDRs. If any returned value of the UDR has a name, then all must have names. Identifier

Usage

In Dynamic Server, for backward compatibility, you can create SPL functions with the CREATE PROCEDURE statement. (That is, you can include a Return clause in CREATE PROCEDURE statements.) Use CREATE FUNCTION, however, to create new SPL routines that return one or more values.

After the Return clause has indicated what data types are to be returned, you can use the RETURN statement of SPL at any point in the statement block to return SPL variables that correspond to the values in the Return clause.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]