sql:关于Oracle的update from语句

本文深入探讨了Oracle中update from结构与SQLServer的差异,详细解释了为何Oracle中不存在from语句,并通过示例代码展示了如何在Oracle环境中实现类似SQLServer中的update from操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

      还是带有SQL Server的习惯,在Oracle中经常使用update from结构,事实上Oracle中是不存在from语句的。

ContractedBlock.gifExpandedBlockStart.gifCode
 1      update hek_om_pop_lines_all
 2      set quantity_2 = quantity_1
 3      from hek_om_pop_lines_all l, hek_om_pop_headers_all h, hek_om_user_ctl_v ctl
 4      where l.header_id = h.header_id
 5      and h.sold_to_org_id = ctl.customer_id
 6      and h.flow_status = 'enter'
 7      and to_char(h.creation_date,'yyyymmdd'>= &p_start_date
 8      and to_char(h.creation_date,'yyyymmdd'<= &p_end_date
 9      and ctl.user_id = 1115 -- apps.fnd_profile.VALUE('user_id')
10      and application = 'POP';
 
error:ORA-00933:SQL Command not properly ended
 
ContractedBlock.gifExpandedBlockStart.gifCode
 1update hek_om_pop_lines_all
 2set quantity_2 = quantity_1
 3where header_id in (select h.header_id 
 4                    from hek_om_pop_headers_all h, hek_om_user_ctl_v ctl
 5                    where h.flow_status = 'enter'
 6                    and to_char(h.creation_date,'yyyymmdd'>= &p_start_date
 7                    and to_char(h.creation_date,'yyyymmdd'<= &p_end_date
 8                    and ctl.user_id = 1115 -- apps.fnd_profile.VALUE('user_id')
 9                    and application = 'POP'
10                    and h.sold_to_org_id = ctl.customer_id); 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值