sql - Convert Update statement to select statement -
i'm struggling convert following update statement select statement. hoping can provide tips on how convert this.
update inventory_part_tab set planner_buyer = (select hb.buyer_code info.hb_pur_plan_upd1 hb hb.part_no = inventory_part_tab.part_no , hb.contract = inventory_part_tab.contract), last_activity_date = decode(contract, '01', to_date(sysdate), '06', (to_date(sysdate) - (3 / 24)), '20', to_date(sysdate), '21', to_date(sysdate)), rowversion = decode(contract, '01', sysdate, '06', (sysdate-(3 / 24)), '20', sysdate, '21', sysdate, '12', (sysdate + (6 / 24))) contract in ('01', '06', '20', '21') , prime_commodity not in ('spcsl','spckt','spccc','spcgk','spcmt') , planner_buyer <> (select hb.buyer_code info.hb_pur_plan_upd1 hb hb.part_no = inventory_part_tab.part_no , hb.contract = inventory_part_tab.contract) , exists (select * info.hb_pur_plan_upd1 hb hb.part_no = inventory_part_tab.part_no , hb.contract = inventory_part_tab.contract); commit;
update <tablename> set <fieldname> = <value> <conditons>
would
select (<value>) <fieldname <tablename> <conditons>
in case <value>
big subquery works same, add parenthesis.
Comments
Post a Comment