Previous Topic

Next Topic

Return Row

Valid in: DBProc

The Return Row statement composes a row using the values computed by the result expressions and returns it to the caller of the procedure in which it is contained. It can only be used within a database procedure. A return row statement can be executed more than once in a single procedure invocation (for example, from within a for or while loop) and offers a mechanism for passing multiple row images back to the caller.

Procedures containing return row statements must also contain a result row clause and the number of expressions in each return row statement must be equal to the number of entries in the result row clause. The data type of the result expressions must also be compatible with the corresponding entries in the result clause.

The return row statement can only be used in a procedure called directly from a host language program. It cannot be used in a procedure that is called from another database procedure.

Previous Topic

Next Topic

Syntax

The Return Row statement has the following format:

RETURN ROW (result_expression {,result_ expression});

Previous Topic

Next Topic

Permissions

Anyone with permission to create procedures can use this statement.

Previous Topic

Next Topic

Related Statements

Create Procedure

For-EndFor

Previous Topic

Next Topic

Example: Return Row

The following is a Return Row example:

Create procedure rowproc … as
    … result row (char(8), int, float) …
begin
    …
    for select department, count(*), avg(salary) into :a, :b, :c from personnel
        group by deptname do
    …
return row (:a, :b, :c);
    endfor;
     …
  end;


© 2007 Ingres Corporation. All rights reserved.