java如何将ArrayList转换为SQL ArrayList
我需要你的帮助来修复将arraylist转换为SQL arraylist的错误。在我的代码中,我将用户选择的值存储在selectedRequests
列表中,然后执行for循环来检索和打印列表的组件。然而,在将检索到的值分配给arraylist
时,我几乎没有遇到什么困难,所以我决定使用list
,然后将列表传递给SQL arraylist
我得到的错误是:
java.sql.SQLException: Fail to convert to internal representation: [2015000015]java.sql.SQLException: Fail to convert to internal representation: [2015000015] at oracle.jdbc.oracore.OracleTypeNUMBER.cArrayToNUMBERArray(OracleTypeNUMBER.java:452) at oracle.jdbc.oracore.OracleTypeNUMBER.toNUMBERArray(OracleTypeNUMBER.java:339)
它指的是下面这一行,也就是tranNoArrList:
ArrayDescriptor arrdescrTranNo = ArrayDescriptor.createDescriptor("HRD.LEV_ENCSEQ", con);
ARRAY tranNoArrTopass = new ARRAY(arrdescrTranNo, con, tranNoArrList);
方法中的代码是:
String[] tranNoArr = new String[3];
List<String> tranNoArrList = new ArrayList<String>();
String[] apprStatusArr = new String[3];
List<String> apprStatusList = new ArrayList<String>();
String[] rejectionReasonArr = new String[3];
List<String> rejectionReasonArrList = new ArrayList<String>();
for (PendingRequests p : selectedRequests) {
System.out.println(p.getRequestNo());
System.out.println(p.getApprovalStatus());
System.out.println(p.getRejectionReason());
tranNoArrList.add(p.getRequestNo());
apprStatusList.add(p.getApprovalStatus());
rejectionReasonArrList.add(p.getRejectionReason());
}
// tranno
ArrayDescriptor arrdescrTranNo = ArrayDescriptor.createDescriptor("HRD.LEV_ENCSEQ", con);
ARRAY tranNoArrTopass = new ARRAY(arrdescrTranNo, con, tranNoArrList);
// ApprovalStatus
ArrayDescriptor arrdescrApprStatus = ArrayDescriptor.createDescriptor("HRD.LEV_ACTIONFLG", con);
ARRAY apprStatusArrTopass = new ARRAY(arrdescrApprStatus, con, apprStatusList);
//RejectionReason
ArrayDescriptor arrdescrRejectionReason =
ArrayDescriptor.createDescriptor("HRD.LEV_REJREASONTYP", con);
ARRAY rejectionReasonArrTopass = new ARRAY(arrdescrRejectionReason, con, rejectionReasonArrList);
你能帮忙吗
共 (0) 个答案