Skip Headers

# Specifying an Input / Output Parameter

Previous

Next

In Example: Stored Procedure Call with an Input/Output Parameter, you specify the parameter `LENGTH` as an input/output parameter and specify the value of the argument when it is passed to the stored procedure using the `StoredProcedureCall` method `addNamedInOutputArgumentValue`. If you do not want to specify a value for the argument, use method `addNamedInOutputArgument`.

Stored Procedure Call with an Input/Output Parameter

    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("CONVERT_FEET_TO_METERs");
    call.addNamedInOutputArgumentValue(
        "LENGTH",          // procedure parameter name
        new Integer(100),  // in argument value
        "LENGTH",          // out argument field name
        Integer.class      // Java type corresponding to type returned by procedure
    )
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    Integer metricLength = (Integer)session.executeQuery(query);