Using stored procedures

Use the call sproc statement to call stored procedures from sanScript. This function doesn’t verify the existence of the named stored procedure or the items in the parameter list when it’s compiled, so be sure to verify that information when writing your call sproc statement.

The application dictionary must contain a prototype procedure for the named stored procedure. This prototype procedure must have the same name as the stored procedure. The first non-comment line of the prototype procedure indicates what the stored procedure will return. It has the following format:

sproc returns long variable;

This line is followed by declarations of any additional in, out or inout parameters for the stored procedure. The prototype reserves the necessary space in the client’s memory for any out parameters. The call sproc statement must be used in the prototype procedure to make the actual call to the SQL stored procedure. When you call the prototype procedure, the SQLScriptPath procedure will be called implicitly, which adds path information to the stored procedure named in the call sproc statement.

The following illustration shows the relationships between the calling script, the prototype procedure and the stored procedure. The calling script calls the prototype procedure, which contains the call sproc statement. This prototype procedure automatically calls the SQLScriptPath procedure to get pathname information for the specified stored procedure. It then sends the command to execute the stored procedure to the server-based database where the named stored procedure is located.

[spacer]


Documentation Feedback