...
The Callable Statement functions are used execute stored procedures and to manage the resultresults. The The DBErrorUDR
is used to handle SQL errors.
Note | ||
---|---|---|
| ||
Please refer to the Notes section on the 9. Database Functions page for details on allowed database data type. |
prepareCall
To prepare a call with an out parameter, the Stored Procedure must be defined with the prepareCall
function.
Code Block |
---|
any CallableStatement.prepareCall ( string dbProfile , string sqlProc(?,?) , boolean captureSQLError (optional) , boolean isFunction (optional) , boolean inclResultParam (optional) ) |
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Name of the database, including the folder name | ||||||||||||
| Name of the stored procedure, including a question mark for each parameters it requires
| ||||||||||||
| Optional parameter that controls error handling. If the parameter's value is set to true, any SQL error gets captured, without disrupting the execution. For more information about how to fetch the SQL error code and message, see the section below, getError. This parameter is set to | ||||||||||||
isFunction | Optional parameter that indicates that the call will be made for a stored function. This parameter is set to false by default. | ||||||||||||
inclResultParam | Optional parameter that you can set to true to apply a result parameter of ?= on the JDBC API stored procedure SQL escape syntax. If the isFunction parameter is set to true, the inclResultParam will be set to true by default. | ||||||||||||
Returns | Callable Statement Identifier. This object is threadsafe and is used when executing calls towards the stored procedure. |
execute
The execute
function maps to the corresponding JDBC API and could differ slightly depending on the JDBC driver.
...
Code Block |
---|
any CallableStatement.execute (any csi, any param1, ..., any paramN) |
Parameter | Description |
---|---|
| The Callable Statement Identifier that is returned from the |
| The values expected by the stored procedure declared in the The parameters must have the same type as defined in the stored procedure. |
Returns | The returned value is the Result Identifier of the execution. A new object is returned for every call executed. |
executeQuery
The executeQuery
function maps to the corresponding JDBC API and could differ slightly depending on the JDBC driver.
...
Code Block |
---|
any CallableStatement.executeQuery (any csi, any param1, ..., any paramN) |
Parameter | Description |
---|---|
| The Callable Statement Identifier that is returned from the |
| The values expected by the stored procedure declared in the The parameters must have the same type as defined in the stored procedure. |
Returns | The returned value is the Result Identifier of the execution. A new object is returned for every call executed. |
executeUpdate
The executeUpdate
function maps to the corresponding JDBC API and could differ slightly depending on the JDBC driver.
...
Code Block |
---|
any CallableStatement.executeUpdate (any csi, any param1, ..., any paramN) |
Parameter | Description |
---|---|
| The Callable Statement Identifier that is returned from the |
| The values expected by the stored procedure declared in the The parameters must have the same type as defined in the stored procedure. |
Returns | The returned value is the Result Identifier of the execution. A new object is returned for every call executed. |
get
The get
function is used to retrieve the result from the executed call.
Code Block |
---|
any CallableStatement.get (any resultIdentifier, int spIndex) |
Parameter | Description |
---|---|
| The Result Identifier that is returned from the |
int
| Index of the requested parameter from the stored procedure (type | |||||
Returns | The value of the out parameter
|
getUpdateCount
This function returns the number of rows that was were affected by the the executeUpdate
function.
Code Block |
---|
int CallableStatement.getUpdateCount(any resultIdentifier); |
Parameter | Description |
---|---|
| The Result Identifier that is returned from the |
Returns | For Oracle databases this will return the following statement: The number of rows in the database that |
were affected by the call. If an update exists -1 will be returned. For MySQL and PostgreSQL databases this will return the following statement: The number of rows in the database that were affected by the update. |
getError
Anchor | ||||
---|---|---|---|---|
|
...
Code Block |
---|
DatabaseFunctions.DBErrorUDR = CallableStatement.getError(any resultIdentifier); |
Parameter | Description |
---|---|
| The Result Identifier that is returned from the |
Returns | Returns an error UDR. For more information about the error UDR, see the section below, DBErrorUDR. If no error occurred, null will be returned. |
Info | ||
---|---|---|
| ||
Stored Procedure definition:
|
...
The following fields are included in the DBErrorUDR
:
Field | Description |
---|---|
ErrorCode (int) | The SQL error code. |
ErrorMessage (string) | The SQL error message. |