技术中心固定资产update|ok|

涉及到的表目前有fa_card,fa_cardhistory,前者是固定资产卡片主表,后者是附表。

我需要更改的卡片资产编码范围在:

然后sql想写成

select * from fa_card where pk_corp='1003' and (card_code between '000000503' and '000000811')
order by card_code for update

查询结果为空。

因为想在上plsql从excel复制更改名称,我因为做了固定资产的使用部门更改,我惊喜的发现ts会变成现在的时间,于是

select * from fa_card where pk_corp='1003' and ts like '2012-06-04 %'
order by card_code for update

可行

之后开始涉及更改原值和累计折旧了,这时候问题来了,NC里面对每个卡片是区分每个月的,也就是每次计提一笔,在fa_cardhistory就一个记录,因此,每个卡片从08年大概80多个需要改动原值的,一共需要改动2万多个。OMG

开始动脑筋。

我在fa_card中不用的一列provider从excel中把原值拷贝到里面,如下图:

然后利用我之前学到的sql,update中涉及两个表之间的关系来更改两万多行中的fa_cardhistory的本币原值。

update (select fa_cardhistory.localoriginvalue a,fa_card.provider b
from fa_cardhistory,fa_card
where fa_cardhistory.fk_card=fa_card.pk_card
and fa_card.pk_corp='1003' and fa_card.ts like '2012-06-04 %')
set a=b

原值终于搞定了:

现在要改累计折旧了,下面的sql应该有问题,因为累计折旧不可能是不变的,不过应付检查可以了

update fa_cardhistory set accudep=0.7*fa_cardhistory.localoriginvalue where
 fk_card in (select pk_card from fa_card where pk_corp='1003' and ts like '2012-06-04 %' )

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值