Stored Procedures

From Apache OpenOffice Wiki
Jump to: navigation, search
  • Stored Procedures

Stored procedures are server-side processes execute several SQL commands in a single step, and can be embedded in a server language for stored procedures with enhanced control capabilities. A procedure call usually has to be parameterized, and the results are result sets and additional out parameters. Stored procedures are handled by the method prepareCall() of the interface

 com::sun::star::sdbc::XPreparedStatement prepareCall( [in] string sql)

The method prepareCall() takes a an SQL statement that may contain one or more '?' in parameter placeholders. It returns a A CallableStatement is a with two additional interfaces for out parameters: is used to declare parameters as out parameters. All out parameters must be registered before a stored procedure is executed.

Methods of
registerOutParameter() Takes the arguments long parameterIndex, long sqlType, string typeName. Registers an output parameter and should be used for a user-named or REF output parameter. Examples of user-named types include: STRUCT, DISTINCT, OBJECT, and named array types.
registerNumericOutParameter() Takes the arguments long parameterIndex, long sqlType, long scale. Registers an out parameter in the ordinal position parameterIndex with the sqlType; scale is the number of digits on the right-hand side of the decimal point.

The is used to retrieve the values of out parameters. It consists of getXXX() methods and should be well-known from the common result sets.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages