還是帶有SQL Server的習慣,在Oracle中經常使用update from結構,事實上Oracle中是不存在from語句的。
Code
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 Code
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);