solidDB Help : Programming : SQL extensions : Stored procedures : Calling other procedures
  
Calling other procedures
A stored procedure can be called from within another stored procedure. The default limit for levels of nested procedures is 16. If the limit is exceeded, the transaction fails. The maximum nesting level is set by using the SQL.MaxNestedProcedures parameter. For details, see SQL section.
Like all SQL statements, a cursor should be prepared and executed as in the following example:
EXEC SQL PREPARE cp
  CALL myproc(?, ?);
  EXEC SQL EXECUTE cp USING (var1, var2);
If the procedure myproc returns one or more values, then a subsequent fetch of the cursor cp retrieves those values, for example:
EXEC SQL PREPARE cp call myproc(?,?);
EXEC SQL EXECUTE cp USING (var1, var2) INTO (ret_var1, ret_var2); EXEC SQL FETCH cp;
Note that if the called procedure contains a RETURN ROW statement, the calling procedure should use a WHILE LOOP construct to fetch all results.
Recursive calls are possible, but discouraged because cursor names are unique at the connection level.
Go up to
Stored procedures