I got this Oracle stored procedure code calling another stored procedure:
PROCEDURE xyz_main (
i_param_a IN VARCHAR2 DEFAULT 'Y',
i_param_b IN PERSON.NAME%TYPE
i_param_c IN VARCHAR2 DEFAULT 'BLA'
o_return_msg OUT VARCHAR2
)
IS
...
BEGIN
...
END xyz_main;
PROCEDURE xyz_example (
i_param_b IN PERSON.NAME%TYPE DEFAULT 'Ben'
o_return_msg OUT VARCHAR2
)
IS
BEGIN
xyz_main(
i_param_b => i_param_b,
i_param_c => 'Great',
o_return_msg => o_return_msg
);
END xyz_example;
Now my task is to call xyz_main by Java. I wrote this code:
// Using question mark because later on the values will be provided by function parameters
// Question: is "o_return_msg => ?" correct, even if I don't provide an input value?
String statement = "BEGIN xyz_main(i_param_b => ?, i_param_c => ?, o_return_msg => ?); END;";
try (Connection conn = getOraConnection();) {
CallableStatement cs = conn.prepareCall(statement);
// cs.setString("i_param_a", "Y"); -- omitted because the default value should be used always
cs.setString("i_param_b", "Ben");
cs.setString("i_param_c", "Great"); // should overwrite the default value
cs.registerOutParameter("o_return_msg", Types.VARCHAR);
cs.execute();
} catch (Exception e) {
...
}
Running the code I get this Exception:
ORA-06550: line 1, column 47:
PLS-00103: Fand das Symbol ">" als eines der folgenden erwartet wurde: ..
In English:
PLS-00103: Found Symbol ">" but expected one of this: ..
What's wrong with this code?