该SQL在SQLPLUS\WORKSHEET里执行没问题
文本文件里的SQL语句如下:truncate table TRS.tb_affair_appendix;
insert into TRS.tb_affair_appendix(GscApproveDatumSetGuid,GscApproveDatumName,GscApproveDatumFormatCodeId,GscApproveDatumCopies,GscApproveProjectCodeId,flag,dealFlag,files) 
select datum.F2,datum.F5,datum.F6,datum.F7,datum.F4,0,0,to_lob(doc.F9) 
from GxGscManage."ApproveDatumSet" datum left join GxGscManage.APPDOCFILE_TEMP doc on datum.F8=doc.F3 and doc.F10=0 where doc.AREACODE='1' 
order by datum.F1;truncate table TRS.tb_affair_evidence;
insert into TRS.tb_affair_evidence(GscApproveWarrantySetGuid,GscApproveWarrantyGovDocTitle,GscApproveWarrantyGovDocItem,GscApproveWarrantyGovDocTime,
GscApproveWarrantyGovDocCodeId,GscApproveProjectCodeId,flag,dealFlag) 
select F2,F5,F6,F11,
F8,F4,0,0 from GxGscManage."ApproveWarrantySet" where F9='GscObjectStatus_OK' and AREACODE='1' 
order by F1;truncate table TRS.tb_affair_condition;
insert into TRS.tb_affair_condition(GscApproveConditionSetGuid,GscApproveCondition,GscApproveProjectCodeId,flag,dealFlag)
select F2,F5,F4,0,0 from GxGscManage.ApproveConditionSet where
F6='GscObjectStatus_OK' and AREACODE='1' 
order by F1;

解决方案 »

  1.   

    sql中存在双引号,java读取后再拼sql就出错了。 
      

  2.   

    sql中存在双引号导致的。
    java中需要把双引号处理下
      

  3.   

    from GxGscManage."ApproveWarrantySet"
    改成
    from GxGscManage.\"ApproveWarrantySet\"这样可以吗?
      

  4.   

    truncate table TRS.tb_dept_affair;
    insert into TRS.tb_dept_affair(approveAffairId,affairDepartment,affairName,approveObj,isCharge,acceptMethod,approveType,
    approveMethod,legalTime,promiseTime,prejudicationTime,approvePlace,memoInfo,belongDepartment,status,
    flag,dealFlag) 
    select app.F2,app.F25,app.F3,app.F11,
    app.F15,app.F19,app.F9,app.F10,app.F21,app.F20,app.F22,
    app.F27,app.F29,org.F3,app.F28,0,0 from (GxGscManage.\"ApproveProject\" app left join GxGscManage.APPDOCFILE_TEMP doc on app.F18=doc.F3 and doc.F10=0) left join GxGscManage.\"GscOrgan\" org on app.F8=org.F2 where app.AREACODE='1' 
    order by app.F1;
    update TRS.tb_dept_affair set approveDocFile = (select to_lob(doc.F9) from GxGscManage.\"ApproveProject\" app,GxGscManage.APPDOCFILE_TEMP doc where app.F18=doc.F3 and doc.F10=0);truncate table TRS.tb_affair_appendix;
    insert into TRS.tb_affair_appendix(GscApproveDatumSetGuid,GscApproveDatumName,GscApproveDatumFormatCodeId,GscApproveDatumCopies,GscApproveProjectCodeId,flag,dealFlag,files) 
    select datum.F2,datum.F5,datum.F6,datum.F7,datum.F4,0,0,to_lob(doc.F9) 
    from GxGscManage.\"ApproveDatumSet\" datum left join GxGscManage.APPDOCFILE_TEMP doc on datum.F8=doc.F3 and doc.F10=0 where doc.AREACODE='1' 
    order by datum.F1;truncate table TRS.tb_affair_evidence;
    insert into TRS.tb_affair_evidence(GscApproveWarrantySetGuid,GscApproveWarrantyGovDocTitle,GscApproveWarrantyGovDocItem,GscApproveWarrantyGovDocTime,
    GscApproveWarrantyGovDocCodeId,GscApproveProjectCodeId,flag,dealFlag) 
    select F2,F5,F6,F11,
    F8,F4,0,0 from GxGscManage.\"ApproveWarrantySet\" where F9='GscObjectStatus_OK' and AREACODE='1' 
    order by F1;truncate table TRS.tb_affair_condition;
    insert into TRS.tb_affair_condition(GscApproveConditionSetGuid,GscApproveCondition,GscApproveProjectCodeId,flag,dealFlag)
    select F2,F5,F4,0,0 from GxGscManage.ApproveConditionSet where
    F6='GscObjectStatus_OK' and AREACODE='1' 
    order by F1;
    我这样些了
    还是要报错呢????
      

  5.   

    java里面是两个\\才可以转义。
    改成 
    from GxGscManage.\\"ApproveWarrantySet\\" 看看