在Oracle数据库中,可以使用以下方法来调用存储过程:
DECLARE
result VARCHAR2(50);
BEGIN
stored_procedure_name(parameter1, parameter2, ..., result);
DBMS_OUTPUT.PUT_LINE(result);
END;
BEGIN
stored_procedure_name(parameter1, parameter2, ...);
END;
CallableStatement cstmt = connection.prepareCall("{call stored_procedure_name(?, ?)}");
cstmt.setString(1, parameter1);
cstmt.setString(2, parameter2);
cstmt.execute();
CallableStatement cstmt = connection.prepareCall("{call stored_procedure_name(?, ?, ?)}");
cstmt.setString(1, parameter1);
cstmt.setString(2, parameter2);
cstmt.registerOutParameter(3, Types.VARCHAR);
cstmt.execute();
String result = cstmt.getString(3);