我想将表中以下三个数据取出 ,再用一个insert语句插入,应该怎么做呢?
Clob ARecOpeCondi=(Clob)request.getParameter("ARecOpeCondi");
Clob ARecProc=(Clob)request.getParameter("ARecProc");
Clob ARecResult=(Clob)request.getParameter("ARecResult");这是错误提示:D:\tomcat\work\localhost_8080%2FLIMS\_0002fYPFX_0002ftongyu_0002ftongyu_0002ejsptongyu_jsp_4.java:132: Invalid cast from java.lang.String to java.sql.Clob.
ARecOpeCondi=(Clob)request.getParameter("ARecOpeCondi");
^
D:\tomcat\work\localhost_8080%2FLIMS\_0002fYPFX_0002ftongyu_0002ftongyu_0002ejsptongyu_jsp_4.java:133: Invalid cast from java.lang.String to java.sql.Clob.
ARecProc=(Clob)request.getParameter("ARecProc");
^
D:\tomcat\work\localhost_8080%2FLIMS\_0002fYPFX_0002ftongyu_0002ftongyu_0002ejsptongyu_jsp_4.java:134: Invalid cast from java.lang.String to java.sql.Clob.
ARecResult=(Clob)request.getParameter("ARecResult");
Clob ARecOpeCondi=(Clob)request.getParameter("ARecOpeCondi");
Clob ARecProc=(Clob)request.getParameter("ARecProc");
Clob ARecResult=(Clob)request.getParameter("ARecResult");这是错误提示:D:\tomcat\work\localhost_8080%2FLIMS\_0002fYPFX_0002ftongyu_0002ftongyu_0002ejsptongyu_jsp_4.java:132: Invalid cast from java.lang.String to java.sql.Clob.
ARecOpeCondi=(Clob)request.getParameter("ARecOpeCondi");
^
D:\tomcat\work\localhost_8080%2FLIMS\_0002fYPFX_0002ftongyu_0002ftongyu_0002ejsptongyu_jsp_4.java:133: Invalid cast from java.lang.String to java.sql.Clob.
ARecProc=(Clob)request.getParameter("ARecProc");
^
D:\tomcat\work\localhost_8080%2FLIMS\_0002fYPFX_0002ftongyu_0002ftongyu_0002ejsptongyu_jsp_4.java:134: Invalid cast from java.lang.String to java.sql.Clob.
ARecResult=(Clob)request.getParameter("ARecResult");
你这样试试
Clob ARecProc=(Clob)request.getParameter("ARecProc");
Clob ARecResult=(Clob)request.getParameter("ARecResult");
你这个是从页面的FORM中取数据吗?
如果是,应该转成String
然后定义一个INSERT SQL串,用接口PreparedStatement,Clob可以以字符串的方式存,也可以流的方式存save as String,example:
String clob = "test";
PreparedStatement tmpstmt= conn.prepareStatement(strSQL);
tmpstmt.setString(1,clob);
int exeValue=tmpstmt.executeUpdate();