引用 16 楼 wkc168 的回复:
引用 15 楼 dhytfzz 的回复:
insert into TBL_Trans_inter_data_ict
select 2 as datatype,'' as vouchid,'' as vouno ,lrzxbm as profit,ywfbbm as bustype,
'' as sap3,'' as TR_FenPei,'' as ……
[/Quote]
[Quote=引用 16 楼 wkc168 的回复:]
引用 15 楼 dhytfzz 的回复:
insert into TBL_Trans_inter_data_ict
select 2 as datatype,'' as vouchid,'' as vouno ,lrzxbm as profit,ywfbbm as bustype,
'' as sap3,'' as TR_FenPei,'' as TR_ShortText,'' as TR_……
[/Quote]数据类型肯定是没有问题的,我已经做过了,还是插入31条,我都快郁闷死了
[Quote=引用 15 楼 dhytfzz 的回复:]
insert into TBL_Trans_inter_data_ict
select 2 as datatype,'' as vouchid,'' as vouno ,lrzxbm as profit,ywfbbm as bustype,
'' as sap3,'' as TR_FenPei,'' as TR_ShortText,'' as TR_LongText, case when ……
[/Quote]
给个思路
把后面插入的记录的select语句的48条记录跟 已经插入到目标表的31条记录做个差集 minus
看差集的记录与你的插入表的数据类型 以及长度进行比较 看看
insert into TBL_Trans_inter_data_ict
select 2 as datatype,'' as vouchid,'' as vouno ,lrzxbm as profit,ywfbbm as bustype,
'' as sap3,'' as TR_FenPei,'' as TR_ShortText,'' as TR_LongText, case when balanorient=1 then '1' else '0' end as Direct,
'0' as SAPFJZ,null as VouDate,''
as IsReturned ,null as BookDate ,ksbm as SupCode,corp.unitcode as Entity,'' expensesAcc,code as AcctCode,
currtypecode as TR_CUR,'' as TR_AMT,
'' as TR_LAMT, amount_yb as TR_UnOffAMT,amount_bb as TR_LUnOffAMT,
'' as TR_RATE,null as AgingDate,'' as OffGroup,null as OffDate,'' as IsDelete,'' as isInvalid,'' as IsOffed, '' as VouUser,'NC' as FinType,'' as UpdateTime,'' as IntraTransaction,'' as BusMakeMan
from (select substr(b.subjcode, 1, 6) as code,
tz.valuecode as ksbm,
tz.valuename as ksmc,
sum(debitamount) - sum(creditamount)
as amount_yb,
sum(localdebitamount) - sum(localcreditamount)
as amount_bb,
tz1.valuecode as ywfbbm,
tz1.valuename as ywfbmc,
tz2.valuecode as lrzxbm,
tz2.valuename as lrzxmc,
b.balanorient,
curr.currtypecode,
a.pk_corp
from (SELECT debitamount, creditamount, localdebitamount, localcreditamount, assid, pk_accsubj,pk_currtype,pk_corp
from gl_balance
where period = '00'
and year ='2010'
and nvl(dr, 0) = 0
and pk_corp ='1014'
and pk_glorgbook='0001V5100000000006A7'
union all
select
b.debitamount,
b.creditamount,
b.localdebitamount,
b.localcreditamount,
b.assid,
pk_accsubj,
b.pk_currtype,a.pk_corp
from gl_voucher a, GL_DETAIL b
where a.PK_VOUCHER = b.PK_VOUCHER
and nvl(a.dr, 0) = 0
and nvl(b.dr, 0) = 0
and a.period > '00'
and a.pk_corp = b.pk_corp
and a.pk_corp ='1014'
and a.year = '2010'
and a.period <= '11'
and a.pk_glorgbook='0001V5100000000006A7'
and a.PREPAREDDATE <= '2010-11-05'
and (a.errmessage is null and (a.discardflag <> 'Y') or
a.errmessage is not null or (a.discardflag = 'Y'))
and a.pk_manager = 'N/A' and a.voucherkind <> 2
and a.voucherkind <> 255) a,
bd_accsubj b,
bd_currtype curr,
(SELECT valuecode,
valuename,
freevalueid,
checktype,
checkvalue
FROM gl_freevalue
WHERE checktype = '00010000000000000073'
and nvl(dr, 0) = 0) tz,
(SELECT valuecode,
valuename,
freevalueid,
checktype,
checkvalue
FROM gl_freevalue
WHERE checktype = '0001V510000000000XWS'
and nvl(dr, 0) = 0) tz1,
(SELECT valuecode,
valuename,
freevalueid,
checktype,
checkvalue
FROM gl_freevalue
WHERE checktype = '0001V510000000000Y8E'
and nvl(dr, 0) = 0) tz2
where tz.freevalueid = a.assid
and tz1.freevalueid = a.assid
and tz2.freevalueid = a.assid
and b.pk_accsubj = a.pk_accsubj
and substr(b.subjcode, 1, 4) in ('1131', '2121', '1151','2131')
and curr.pk_currtype=a.pk_currtype
group by tz1.valuecode,
tz1.valuename,
tz.valuecode,
tz2.valuename,
tz2.valuecode,
tz.valuename,
b.balanorient,
curr.currtypecode,
substr(b.subjcode, 1, 6),
a.pk_corp) m,bd_corp corp
where m.amount_bb <> 0 and corp.pk_corp=m.pk_corp and substr(m.ksbm,1,4)='9999'