我正在尝试使用 JSP 将几个值插入到 oracle 表(oracle 10g)中。我一直遇到 ORA-01861 错误...有人可以帮帮我吗?
int eid = Integer.parseInt(request.getParameter("srno"));
String enm = "";
int exit_tp = Integer.parseInt(request.getParameter("applntype"));
int ecadre = 0;
String ecdr = "";
String epost = "";
String edob = "";
String eappt_da = "";
String ecadre_date = "";
String edor = "";
String esubmitted_by = "";
String esubmitted_ip = "";
String ezn = "";
String ezone = "";
String edivision = "";
String ebranch = "";
String tmp = "select ep.name,ep.cadre,cd.descpn,epv.post,ep.dob,ef.appt_da,ep.cadre_date,add_months(ep.dob-1,720),z.short,ep.zone,ep.division,ep.branch " +
"from empfile ef,emp_prov ep,v$emp_prov epv,cadre cd,zone z " +
"where ep.srno=epv.srno(+) " +
"and ef.srno=ep.srno(+) " +
"and ep.cadre=cd.code(+) " +
"and ep.zone=z.zn(+) " +
"and ep.srno=" + eid;
PreparedStatement stmt = conn.prepareStatement(tmp);
ResultSet rset = stmt.executeQuery();
if (rset.next()) {
enm = rset.getString(1);
ecadre = rset.getInt(2);
ecdr = rset.getString(3);
epost = rset.getString(4);
edob = rset.getString(5);
eappt_da = rset.getString(6);
ecadre_date = rset.getString(7);
edor = rset.getString(8);
ezn = rset.getString(9);
ezone = rset.getString(10);
edivision = rset.getString(11);
ebranch = rset.getString(12);
}
rset.close();
stmt.close();
String tmp1 = "insert into online_exit(srno,name,exitcode,cadre,post,dob,appt_da,cadre_date,dor,submit_date,submit_stt,zone,division,branch) " +
"values (?,?,?,?,?,to_date(?,'DD/MM/YYYY'),to_date(?,'DD/MM/YYYY'),to_date(?,'DD/MM/YYYY'),to_date(?,'DD/MM/YYYY'),SYSDATE,2,?,?,?)";
PreparedStatement pstmt = conn.prepareStatement(tmp1);
pstmt.setInt(1, eid);
pstmt.setString(2, enm);
pstmt.setInt(3, exit_tp);
pstmt.setInt(4, ecadre);
pstmt.setString(5, epost);
pstmt.setString(6, edob);
pstmt.setString(7, eappt_da);
pstmt.setString(8, ecadre_date);
pstmt.setString(9, edor);
pstmt.setString(10, ezone);
pstmt.setString(11, edivision);
pstmt.setString(12, ebranch);
pstmt.executeUpdate();
pstmt.close();
conn.close();
表格说明如下
Name Null? Type
----------------------------------------- -------- ------------
SRNO NOT NULL NUMBER(6)
NAME VARCHAR2(50)
EXITCODE NUMBER(2)
CADRE NUMBER(2)
POST VARCHAR2(30)
DOB DATE
APPT_DA DATE
CADRE_DATE DATE
CONF_STT VARCHAR2(3)
DOR DATE
VIG_DIS_STT VARCHAR2(50)
APPLN_DA DATE
APPLN_ACK_DA DATE
REC_CO_DA DATE
PREF_EXIT_DA DATE
NOTICE_PER_EXP_DA DATE
REASON VARCHAR2(50)
PENSION_OPT VARCHAR2(2)
REVERSN VARCHAR2(2)
COMP_AUTH NUMBER
EXIT_DATE DATE
SUBITTED_BY NUMBER(6)
SUBMIT_DATE DATE
SUBMITTED_IP VARCHAR2(15)
VALIDATED_BY NUMBER(6)
VALIDATED_ON DATE
VALIDATE_IP VARCHAR2(15)
SUBMIT_STT NUMBER(2)
ZONE VARCHAR2(2)
DIVISION VARCHAR2(3)
BRANCH VARCHAR2(4)