Skip Headers

# Specifying a SQLCall Output Parameter

Previous

Next

In Example: Specifying a SQLCall with an Output Parameter Using the ### Prefix, you specify `employee_id` as an output parameter by prefixing its name with three number signs (`###` ). You specify the type of the output parameter with `SQLCall` method `setCustomSQLArgumentType`. You continue to specify `last_name` as an input parameter by prefixing its name with a number sign ( `#` ).

Specifying a SQLCall with an Output Parameter Using the ### Prefix

    SQLCall sqlCall = new SQLCall("begin;
        INSERT INTO EMPLOYEE (L_NAME) VALUES (#L_NAME) RETURNING EMP_ID INTO ###employee_id;
        end");
    sqlCall.setCustomSQLArgumentType("employee_id", Integer.class);

Executing a SQLCall with an Output Parameter

    ValueReadQuery query = new ValueReadQuery();
    query.setCall(sqlCall);
    query.addArgument("last_name");   // input

    Vector args = new Vector();
    args.add("MacDonald");

    Number employeeID = (Number)getSession().executeQuery(query, args);

You can also obtain results for an output parameter declared to be of type `CURSOR`.