Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.4k views
in Technique[技术] by (71.8m points)

oracle数据库,如下代码,其中有一个变量携带的是clob类型的数据,如何插入数据库呀?

直接插入的话,会报错字符过长,所以设置成了clob类型,代码中要怎么设置呢?

SQLQuery query = null;
            String params[] =sqlSources.get(paramID).split(",");        
            query = jbpmContext.getSession().createSQLQuery(sqlSources.get(sqlID));            
            for(int i=0,len = params.length; i<len; i++){
                if(i==len-1){
                    query.setLong(i,Long.parseLong(formValue.get(params[i])));
                }else{
                    //log.info(params[i] +":===:"+formValue.get(params[i]));
                    query.setString(i, formValue.get(params[i]));
                }
            }
            int row = query.executeUpdate();
            result = ( row == 1 ? true : false);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...