update tg_purchase_acc_sl_line pasll
set pasll.gross_weight = c.jingzhong
,pasll.process_charge = c.jiagong_jine
from
(select b.*
,b.jingzhong
,round(chengben * 0.06, 3) zafei
,round(chengben * 0.1, 3) lirun
,round((chengben + chengben * 0.06 +
chengben * 0.1) * 0.09 / 0.91,
3) shui
,round(chengben + chengben * 0.06 +
chengben * 0.1 +
(chengben + chengben * 0.06 +
chengben * 0.1) * 0.09 / 0.91,
3) danjia
,round((chengben + chengben * 0.06 +
chengben * 0.1 +
(chengben + chengben * 0.06 +
chengben * 0.1) * 0.09 / 0.91) *
quantity,
2) jine
from (select a.*
,liaoe_jine + baofeie +
dianfei_jine + jiagong_jine +
muju_jine chengben
from (select a.pac_period_id
,a.vendor_id
,a.inventory_item_id
,a.quantity
,round(a.net_weight * 1.03,
0) jingzhong
,round(a.net_weight * 1.03 *
a.material_price / 1.06 / 1000,
2) liaoe_jine
,a.inserts_number *
a.inserts_price qianjian_jine
,round(a.fixed_salary /
(3600 /
a.mould_time *
a.mould_number),
2) jiagong_jine
,round(a.electric_power *
a.electric_utilization * 0.8 /
(3600 /
a.mould_time *
a.mould_number),
3) dianfei_jine
,round((a.net_weight * 1.03 *
a.material_price / 1.06 / 1000 +
a.electric_power *
a.electric_utilization * 0.8 /
(3600 /
a.mould_time *
a.mould_number)) *
a.scrappage,
3) baofeie
,round(3600 /
a.mould_time *
a.mould_number,
0) chumo_banchan
,nvl(round(a.mould_cost /
(a.mould_use_time *
a.mould_number),
2),
0) muju_jine
from tg_purchase_acc_sl_line a) a) b) c更新表tg_purchase_acc_sl_line中的数据,数据来源于该表的计算,如何把这些查询结果更新到表中,上面写法是有错误的,希望大家帮忙修改一下
set pasll.gross_weight = c.jingzhong
,pasll.process_charge = c.jiagong_jine
from
(select b.*
,b.jingzhong
,round(chengben * 0.06, 3) zafei
,round(chengben * 0.1, 3) lirun
,round((chengben + chengben * 0.06 +
chengben * 0.1) * 0.09 / 0.91,
3) shui
,round(chengben + chengben * 0.06 +
chengben * 0.1 +
(chengben + chengben * 0.06 +
chengben * 0.1) * 0.09 / 0.91,
3) danjia
,round((chengben + chengben * 0.06 +
chengben * 0.1 +
(chengben + chengben * 0.06 +
chengben * 0.1) * 0.09 / 0.91) *
quantity,
2) jine
from (select a.*
,liaoe_jine + baofeie +
dianfei_jine + jiagong_jine +
muju_jine chengben
from (select a.pac_period_id
,a.vendor_id
,a.inventory_item_id
,a.quantity
,round(a.net_weight * 1.03,
0) jingzhong
,round(a.net_weight * 1.03 *
a.material_price / 1.06 / 1000,
2) liaoe_jine
,a.inserts_number *
a.inserts_price qianjian_jine
,round(a.fixed_salary /
(3600 /
a.mould_time *
a.mould_number),
2) jiagong_jine
,round(a.electric_power *
a.electric_utilization * 0.8 /
(3600 /
a.mould_time *
a.mould_number),
3) dianfei_jine
,round((a.net_weight * 1.03 *
a.material_price / 1.06 / 1000 +
a.electric_power *
a.electric_utilization * 0.8 /
(3600 /
a.mould_time *
a.mould_number)) *
a.scrappage,
3) baofeie
,round(3600 /
a.mould_time *
a.mould_number,
0) chumo_banchan
,nvl(round(a.mould_cost /
(a.mould_use_time *
a.mould_number),
2),
0) muju_jine
from tg_purchase_acc_sl_line a) a) b) c更新表tg_purchase_acc_sl_line中的数据,数据来源于该表的计算,如何把这些查询结果更新到表中,上面写法是有错误的,希望大家帮忙修改一下
解决方案 »
- 表连接查询的效率问题
- PL/SQL只有不选数据库才能进入
- RH 3.2.2-5版本能装oracle10g么
- Relational Algebra(关连式代数),高手请进
- 怎样将记录的sql语句完整保存到文件
- 从oracle网站下的oracle10g的文档是在线文档,需要上网才能查,在哪里有离线文档下载?
- 抗日新方式!!!kkiillll $%^&#日¥#¥本@!#猪&&台¥#¥独!D分子!!!
- oracle有没有布尔型数据类型啊????
- .NET下怎么连接Oracle?
- 请问各位erwin的序列号是什么?mo000001;7725078270158297;都不行!
- oracle 数据库恢复
- oracle RAC中vip的作用?
你可以用update ..
set ...
where exists ....
来做
set (s.字段1,s.字段2) = (select 字段1, 字段2 from 表2 t
where s.id = t.id)
Merge into table[alias]
Using table or sql query [alias]
On condition
When matched then
Update set ….
When not matched then
Insert values…