Oracle中对超长内容的处理,防止呈现can bind a LONG value only for insert into a LONG column过错ITeye头条 - AG环亚娱乐

Oracle中对超长内容的处理,防止呈现can bind a LONG value only for insert into a LONG column过错ITeye头条

2019-02-02 11:07:50 | 作者: 凌旋 | 标签: 核算,结构,批量 | 浏览: 2038

表结构rncreate table Q_RESOURCE_POOLrn(rn CALC_TYPE NUMBER(2) not null,rn USER_NO NUMBER(10) not null,rn DINNER_SN NUMBER(12) not null,rn DINNER VARCHAR2(6) not null,rn BILL_ATOM VARCHAR2(6) not null,rn CYCLE_MONTH VARCHAR2(8) not null,rn GRADE NUMBER(2) not null,rn TOTAL NUMBER(13) not null,rn ADDUP_BASE NUMBER(13) not null,rn ADDUP_LAND NUMBER(13) not null,rn ADDUP_SS NUMBER(13) not null,rn ADDUP_OTHER NUMBER(13) not null,rn FILE_SN NUMBER(13) default 0,rn SEQ_NO NUMBER(13) default 0,rn ENQUEUE_LEVEL NUMBER(2) not null,rn ENQUEUE_DATE DATE not null,rn CHARGE_DATE DATErn)rnrnrnstruct st_record_info rn long user_no; //1rn char dinner [BILL_DINNER_LEN+1]; //4rn char bill_atom [BILL_ATOM_LEN+1]; //5rn long dinner_sn; //7rn char cycle_month[DATEMONTH_LEN+1]; //9rn int grade; //12rn long total; //13rn long addup_base; //15rn long addup_land; //16rn long addup_ss; //17rn long addup_other; //18+14rn long file_sn;rn long seq_no;rn char charge_date [DATETIME_LEN+1]; //19rn;rnrntypedef value_type st_record_info ;rnrn void refresh_resource_realtime::data_update()rn rn //int Counter(0);rn string sql;rn Statement* stmt;rnrn ostringstream oss;rn oss refresh_resource_realtime 触发批量更新线程 rn lfile- write_log(oss.str());rn oss.str( rn try rn //calc_type 0正常核算 1反常发动核算 2预算 值越小优先级越高rn //enqueue_level 值越小优先级越高 (1-info_user 2-life_device 3-life_dinner 4-计费文件)rn sql = insert into q_resource_pool (calc_type,user_no,dinner_sn,dinner,bill_atom,cycle_month,grade,total,addup_base,addup_land, rn addup_ss,addup_other,file_sn,seq_no,enqueue_level,charge_date,enqueue_date) rn values (0,:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,4,to_date(:14,yyyymmddhh24miss),sysdate ) rnrn stmt = pDatabase- create_statement(sql);rn if( stmt- getMaxIterations() data_list.size() ) stmt- setMaxIterations(data_list.size() );rn stmt- setMaxParamSize(3, BILL_DINNER_LEN);rn stmt- setMaxParamSize(4, BILL_ATOM_LEN);rn stmt- setMaxParamSize(5, DATEMONTH_LEN);rn stmt- setMaxParamSize(14, DATETIME_LEN);rn //Counter=0;rn vector::iterator iter = data_list.begin();rn for (;iter != data_list.end();iter++ ) rn /*rn if ( Counter 0 ) rn stmt- addIteration();rn rn */rn if( iter != data_list.begin() ) stmt- addIteration();rn stmt- setNumber(1,iter- user_no);rn stmt- setNumber(2,iter- dinner_sn);rn stmt- setString(3,iter- dinner);rn stmt- setString(4,iter- bill_atom);rn stmt- setString(5,iter- cycle_month);rn stmt- setNumber(6,iter- grade);rn stmt- setNumber(7,iter- total);rn stmt- setNumber(8,iter- addup_base);rn stmt- setNumber(9,iter- addup_land);rn stmt- setNumber(10,iter- addup_ss);rn stmt- setNumber(11,iter- addup_other);rn stmt- setNumber(12,iter- file_sn);rn stmt- setNumber(13,iter- seq_no);rn stmt- setString(14,iter- charge_date);rn //Counter++;rnrn // 批量提交rn /*rn if ( FETCH_COUNT Counter ) rn stmt- executeUpdate();rn pDatabase- commit();rn Counter = 0;rn rn */rn rn //if ( Counter 0 )rn stmt- executeUpdate();rn pDatabase- commit();rn pDatabase- terminate_statement( stmt );rn stmt = 0;rn data_list.clear();rn catch (SQLException ex) rn vector::iterator iter = data_list.begin(); rn for (;iter != data_list.end();iter++ ) rn oss user_no=[ user_no ] dinner_sn=[ dinner_sn ] dinner=[ dinner ] bill_atom=[ bill_atom;rn oss ] cycle_month=[ cycle_month ] grade=[ grade ] total=[ total ] addup_base=[ addup_base;rn oss ] addup_land=[ addup_land ] addup_ss=[ addup_ss ] addup_other=[ addup_other ] file_sn=[ file_sn;rn oss ] seq_no=[ seq_no ] charge_date=[ charge_date;rn lfile- write_log(oss.str());rn oss.str( rn rn pDatabase- terminate_statement(stmt);rn pDatabase- rollback();rn throw bad_db(__FILE__, __LINE__, ex);rn rn rnrn偶然会出抛出反常,大侠们看看,谢谢!

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表AG环亚娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章