Valid in: ESQL
The Call statement allows an embedded SQL application to call the operating system or an Ingres tool (such as QBF or Report-Writer).
When used to call the operating system, this statement executes the specified command_string as if the user typed it at the operating system command line. After the command_string is executed, control returns to the application at the statement following the CALL statement.
The Call statement has the following format:
To call the operating system:
EXEC SQL CALL SYSTEM (COMMAND = command_string)
To call an Ingres tool:
EXEC SQL CALL subsystem (DATABASE = dbname {, parameter = value})
where:
Specifies the command to be executed at the operating system level when the operating system is called. If command_string is a null, empty, or blank string, the statement transfers the user to the operating system and the user can execute any operating system command. Exiting or logging out of the operating system returns the user to the application.
Is the name of the Ingres tool.
Is the name of the current database.
Are one or more parameters specific to the called subsystem.
Is the value assigned to the specified parameter.
The command_string can invoke an Ingres tool. For example:
exec sql call system (command = 'qbf personnel');
However, it is more efficient to call the subsystem directly:
exec sql call qbf (database = 'personnel');
When a subsystem is called directly, the database argument must identify the database to which the session is connected. The CALL statement is not sent to the database. For this reason, it cannot appear in a dynamic SQL statement string. When calling an Ingres tool, an application cannot rely on the dynamic scope of open transactions, open cursors, prepared queries, or repeated queries. The application must consider each subsystem call as an individual DBMS Server session. The Ingres tool commits any open transaction when it starts. For this reason, it is a good practice to commit before calling the subsystem.
All users are permitted to use this statement.
The following are Call statement examples:
exec sql commit;
exec sql call report (database='personnel',
name='employee', mode='column');
exec sql commit;
exec sql call qbf (database='personnel',
qbfname='expenses', flags='-mappend -s');