(Contents)(Previous)(Next)

Calling DB Procedures

SQL-PL routines can also call DB procedures, apart from other routines and forms. DB procedures are special SQL-PL routines that run in the database kernel (see chapter DB Procedures ).

A DB procedure can be called with the CALL DBPROC statement while specifying the name of the procedure. If a DB procedure belonging to another program or another owner is to be called, the appropriate owner name or program name must be specified.

The names must only be specified as constants. In addition, the called DB procedure must already exist at the translation point in time.

The current parameters for a DB procedure call can be SQL-PL variables, expressions or constants.

After the execution of a DB procedure, a COMMIT is implicitly issued for the SQL return code = 0, but no ROLLBACK for the SQL return code <> 0, if this DB procedure was called WITH COMMIT. Otherwise, the transaction concept of SQL-PL applies (see chapter Database Accesses).

The call as SQL statement is equivalent to this DB procedure call typical for SQL-PL:

If TEST DBPROC has been specified as module option, the processing of the called routine is not performed by the database server. Instead, the call for a DB procedure is simulated internally so that the test facilities of SQL-PL are available. The called routine does not have to be a DB procedure nor be adapted for use as such, so that WRITE statements and REPORT calls can be used. The parameter definition, however, must be a DB procedure.

In contrast to calling an SQL-PL module by CALL PROC or SWITCHCALL,

- each argument is checked on the basis of the parameter declarations of the called routine.

- $RC and $RT are assigned, e.g., a runtime error or the STOP statement.

- subtransactions in DB procedures must be formulated explicitly.

Syntax:


(Contents)(Previous)(Next)