Skip Headers

# Using a StoredProcedureCall

Previous

Next

You can provide a `StoredProcedureCall` object to any query instead of an expression or a SQL string, but the procedure must return all data required to build an instance of the class you query.

A Read-All Query with a Stored Procedure

    ReadAllQuery readAllQuery = new ReadAllQuery();
    call = new StoredProcedureCall();
    call.setProcedureName("Read_All_Employees");
    call.useNamedCursorOutputAsResultSet("RESULT_SET");
    readAllQuery.setCall(call);
    Vector employees = (Vector) session.executeQuery(readAllQuery);

Using a `StoredProcedureCall`, you can access the following:

- Specifying an Input Parameter

- Specifying an Output Parameter

- Specifying an Input / Output Parameter

- Using an Output Parameter Event

Note: You no longer need to use `DatabaseQuery` method `bindAllParameters` when using a `StoredProcedureCall` with `OUT` or `INOUT` parameters. However, you should always specify the Java type for all `OUT` and `INOUT` parameters. If you do not, be aware of the fact that they default to type `String`.