使用unidac 3.00.0.6 版本,连接数据库Oracle Database 11g Enterprise Edition 11.1.0.6.0 ,使用中文字符集:ZHS16GBK,进行SQL insert操作,提示ora-12899,具体如下:
oq2.Close ;
                  oq2.SQL.Text :='insert into T_CollectJobState (Lsh,Collrq,CollTime,CollectBox,RealRecNum,CollRecNum,headNum,roadNum,unsucNum,NonRec,TestNum,State,jsjh,czyh,pt)';
                  oq2.SQL.Add('Values(:lsh,:collrq,:colltime,:CollectBOx,:RealRecNum,0,0,0,0,0,0,0,:jsjh,:czyh,1)');
                  oq2.ParamByName('lsh').AsString :='123456';
                  oq2.ParamByName('collrq').AsString :='20100301';
                  oq2.ParamByName('colltime').AsString :='120000';
                  oq2.ParamByName('CollectBox').AsString :='00001000';
                  oq2.ParamByName('RealRecNum').Asinteger :=1000;
                  oq2.ParamByName('jsjh').AsString :='99' ;
                  oq2.ParamByName('czyh').AsString :='001'  ;
                  oq2.Prepared:=true;
                  oq2.ExecSQL ;
ORA-12899: value too large for column “T_COLLECTJOBSTATE"."COLLTIME" (actual: 8, maximum: 6)
注:colltime数据库中定义varchar2(6)
请各位大虾帮忙看看,谢谢

解决方案 »

  1.   

    不是全角,我怀疑是unidac问题,因为我使用UniConnection,直接连接数据库,就报这个错误;
    不直接连接oracle,通过oracle的服务连接名连接,没有问题
      

  2.   

    字符集不匹配,注意2010中的string类型均为widestring类型。
      

  3.   

    应该是字符宽度的问题,params的size 是多少?
      

  4.   

    dbmonitor监控结果:
    2010/3/4 17:50:14 0.016 SQL Unprepare: insert into T_CollectJobState (Lsh,Collrq,CollTime,CollectBox,RealRecNum,CollRecNum,headNum,roadNum,unsucNum,NonRec,TestNum,State,jsjh,czyh,pt)
    :lsh(WideString[6])='123456' 
    :collrq(WideString[8])='20100301' 
    :colltime(WideString[6])='120000' 
    :CollectBOx(WideString[8])='00001000' 
    :RealRecNum(Integer)=1000 
    :jsjh(WideString[2])='99' 
    :czyh(WideString[3])='001' Complete
      2010/3/4 17:50:14 0.000 Disconnect: [email=***@***.***.***.***:1521]***@***.***.***.***:1521[/email]:***** Complete
      2010/3/4 17:50:14 0.171 Connect:  [email=***@***.***.***.***:1521]***@***.***.***.***:1521[/email]:***** Complete 
      2010/3/4 17:50:14 0.000 SQL Prepare: insert into T_CollectJobState (Lsh,Collrq,CollTime,CollectBox,RealRecNum,CollRecNum,headNum,roadNum,unsucNum,NonRec,TestNum,State,jsjh,czyh,pt)
    Values(:lsh,:collrq,:colltime,:CollectBOx,:RealRecNum,0,0,0,0,0,0,0,:jsjh,:czyh,1)
    :lsh(WideString[6])='123456' 
    :collrq(WideString[8])='20100301' 
    :colltime(WideString[6])='120000' 
    :CollectBOx(WideString[8])='00001000' 
    :RealRecNum(Integer)=1000 
    :jsjh(WideString[2])='99' 
    :czyh(WideString[3])='001' Complete
      2010/3/4 17:50:14 1.014 SQL Execute: insert into T_CollectJobState (Lsh,Collrq,CollTime,CollectBox,RealRecNum,CollRecNum,headNum,roadNum,unsucNum,NonRec,TestNum,State,jsjh,czyh,pt)
    Values(:lsh,:collrq,:colltime,:CollectBOx,:RealRecNum,0,0,0,0,0,0,0,:jsjh,:czyh,1)
    :lsh(WideString[6])='123456' 
    :collrq(WideString[8])='20100301' 
    :colltime(WideString[6])='120000' 
    :CollectBOx(WideString[8])='00001000' 
    :RealRecNum(Integer)=1000 
    :jsjh(WideString[2])='99' 
    :czyh(WideString[3])='001' 
      

  5.   

    New build of UniDAC version 3.00.0.7 is available for download now. 
    This version includes:
    Ability to use Access system database added Added DetectFieldsOnPrepare parameter for NexusDB ODBC driver Added ability to send call stack information to the dbMonitor component Fixed bug with refreshing record when using master/detail relationship Fixed bug with LocalUpdate in the CachedUpdates mode Fixed bug with displaying nvarchar2 fields when UseUnicode is true Fixed bug with getting IndexFieldNames list in design time Fixed several bugs with getting information about SQLite database using the TUniMetadata component Fixed bug with processing TableInfo for SQLite Fixed bug with DBMonitor for C++ Builder 6 这应是BUG,正在期待新的版本下载
      

  6.   

    测试UniDAC version 3.00.0.7 ,错误依旧
    params的size如下图:
      

  7.   

    如果确定是长度问题,数据库可修改的话就修改表结构吧!没必要管他是谁的bug