이와 같이 Callable JDBC Statement를 사용할 수 있습니다.
public static void main(String[] args) throws Exception {
String driver = "oracle.jdbc.driver.OracleDriver";
Class.forName(driver).newInstance();
System.out.println("Connecting to database...");
String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:ORCL";
Connection conn = DriverManager.getConnection(jdbcUrl, "yourName", "mypwd");
//callable statement
CallableStatement cstmt = conn.prepareCall("{call SearchByTitle(?,?)}");
cstmt.setInt(1, "first param value");
cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
cstmt.execute();
//getting output param value
String empName = cstmt.getString(2);
System.out.println(empName);
conn.close();
}
저장 프로 시저로 수행하려는 이유는 무엇입니까? – Jens
입력시 가져온시의 모든 내용을 출력하려면 – neymark