CallableStatement cstmt = null;
try {
// 프로시저 콜
cstmt = con.prepareCall("{call procedureName(?, ?)}");
// IN parameter설정
cstmt.setString(1, ?);
// Out parameter의 Type설정
cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
cstmt.execute();
// Out parameter의 값을 얻고, 출력한다.
System.out.println("result : " + c.getString(2));
} catch(Exception e) {
e.printStackTrace();
throw e;
} finally {
if(cstmt != null) try { cstmt.close(); } catch(Exception ignore) {}
}
'자바 > SE' 카테고리의 다른 글
| 정규식을 이용한 다양한 예제 (3) | 2010.05.16 |
|---|---|
| CallableStatement 사용하기 (0) | 2008.06.26 |
| Oracle의 Stored Procedure, Function 이용하기 (0) | 2008.06.26 |
| 소수점 연산 (0) | 2008.06.26 |
| Jakarta POI Excel File 읽기, 쓰기, 셀컨트롤, 이미지 삽입 (1) | 2008.06.26 |
댓글을 달아 주세요