Re: Sqlplus: Embedded update statement
From: David Bath <dtb_at_otto>
Date: 7 Feb 93 14:14:01 GMT
Message-ID: <dtb.729094441_at_otto>
Date: 7 Feb 93 14:14:01 GMT
Message-ID: <dtb.729094441_at_otto>
pkane_at_cisco.com (Peter Kane) writes:
>I have two tables, call them "order" and "header",
OUCH !!!!! Is not ORDER a reserved word? Even if not, avoid using it.
>and they both have two columns called "value_id" and "lead".
>I want something like:
>
> update header.lead, setting header.lead = order.lead
> where header.value_id = order.value_id
update header h
set h.lead = (select o.lead from ord o where o.value_id = h.value_id)
This works in straight SQL/Plus and in a correlated subquery.
SIMPLE ?
Regards,
David T. Bath
David T. Bath | Email:dtb_at_otto.bf.rmit.oz.au (131.170.40.10) Senior Tech Consultant | Phone: +61 3 347-7511 TZ=AEST-10AEDST-11 Global Technology Group | 179 Grattan St, Carlton, Vic, 3153, AUSTRALIA"The robber of your free will does not exist" - Epictetus
-- David T. Bath | Email:dtb_at_otto.bf.rmit.oz.au (131.170.40.10) Senior Tech Consultant | Phone: +61 3 347-7511 TZ=AEST-10AEDST-11 Global Technology Group | 179 Grattan St, Carlton, Vic, 3153, AUSTRALIA "The robber of your free will does not exist" - EpictetusReceived on Sun Feb 07 1993 - 15:14:01 CET