CallableStatement
public Long getEmployeeIdForAttendance(String attendName) {
Long empId = null;
String callabelStm = "begin ?:=HRS_EMP_PKG.GET_EMPID_4ATTEND(?); end;";
CallableStatement cstm = getDBTransaction().createCallableStatement(callabelStm, 1);
try {
cstm.registerOutParameter(1, Types.NUMERIC);
cstm.setObject(2, attendName.trim());
cstm.executeUpdate();
empId = cstm.getLong(1);
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (cstm != null) {
try {
cstm.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return empId;
}
Long empId = null;
String callabelStm = "begin ?:=HRS_EMP_PKG.GET_EMPID_4ATTEND(?); end;";
CallableStatement cstm = getDBTransaction().createCallableStatement(callabelStm, 1);
try {
cstm.registerOutParameter(1, Types.NUMERIC);
cstm.setObject(2, attendName.trim());
cstm.executeUpdate();
empId = cstm.getLong(1);
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (cstm != null) {
try {
cstm.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return empId;
}
Comments