Skip to content

SQLCall Command

Obsolete

Refer to the SQLCall method in the cSQLStatement class.

SQLCall sProcName sSchema [Arg1] [To Retval]

The SQLCall command allows the programmer to call stored procedures. The number of arguments and return value depend on the procedure definition. Stored procedures can have three different types of arguments: in, out, and in/out. All these types are supported.

It is possible for stored procedures to contain SELECT statements and thus return one or more result sets in addition to the out arguments and return value. Conceptually, the out arguments and return value are also a result set. Some back ends will fill the arguments and return value immediately, while others will always return other result sets before filling the arguments and return value. For example, Microsoft SQL Server always returns arguments and return value as the last result set. In this case, the arguments need to be requested from the statement in a separate call using the SQLGetArguments command. Multiple result sets can be handled by switching to the next result set using the SQLNextResultSet command.

SQLConnect "MSSQLDRV" "SERVER=(Local);Trusted_Connection=yes;DATABASE=Order" To hdbc
SQLOpen hdbc To hStmt
SQLCall hStmt "sp_MonthlyBatch" "bpo" nTotalAmount To iSuccess
If (iSuccess) ;
    Showln "The total amount of the monthly batch is: " nTotalAmount
Else ;
    Showln "The monthly batch did not succeed."