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

(1)
Return Clause

1 RETURNING
1  RETURNS
1 
2.1  %Subset of SQL Data Types1
2.1  REFERENCES
2.2.1 BYTE
2.2.1 TEXT
1?  AS parameter
1 2 + ,
2.1  %Subset of SQL Data Types1
2.1  REFERENCES
2.2.1 BYTE
2.2.1 TEXT
1?  AS parameter
Notes:

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

Usage

For compatibility with earlier HCL OneDB™ releases, 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.