This stored procedure returns a status value of 1 or 0, depending on whether the city that is specified in the cityName parameter is found in the Person.Address table. Although the SQLServerCallableStatement class provides support for using the parameter's name to indicate the specific parameter, you can use only a parameter's ordinal position number for return status parameters.Īs an example, create the following stored procedure in the sample database: CREATE PROCEDURE CHAR(50)) Since IN and OUT parameters auto detected by SimpleJdbcCall, declaring parameters is optional, so that commented out in following program. To initialize SimpleJdbcCall, you need to provide JdbcTemplate or DataSource instance. DELIMITER CREATE PROCEDURE spInsertEmployee (IN EmployeeName nvarchar (20), IN EmployeeSurname nvarchar (20), IN DepartmentName nvarchar (20) ) BEGIN. In the case of the return status parameter, its ordinal position will always be 1 because it is always the first parameter in the call to the stored procedure. Following is a simple example to call Stored Procedure using Spring SimpleJdbcCall. In addition, when you pass a value to the registerOutParameter method for a return status parameter, you must specify not only the data type to be used for the parameter, but also the parameter's ordinal placement in the stored procedure call. When using the JDBC driver with a SQL Server database, the value that you specify for the return status parameter in the registerOutParameter method will always be an integer, which you can specify by using the data type.
0 Comments
Leave a Reply. |