Re: Sqlplus: Embedded update statement
Date: Tue, 16 Feb 1993 17:27:50 GMT
Message-ID: <C2JxuE.KLK_at_vistachrome.com>
Why not do this:
UPDATE HEADER
SET HEADER.LEAD =
(SELECT MIN(LEAD) FROM ORDER
WHERE HEADER.VALUE_ID=ORDER.VALUE_ID)
WHERE {conditions for updating header such as HEADER.LEAD IS NULL}
;
-Andy
pkane_at_cisco.com (Peter Kane) writes:
>Hi Oracle gurus, please help if you can.
>I have two tables, call them "order" and "header",
>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
>In other words, I would like to copy lead from one table to another,
>where the value_id is the same. I'd like to do it in an embedded
>SQL statement if I can, but I guess I'm afraid I'll have to use
>cursor, or PL/SQL or something.
>Is there an easy way to do something like this?
>Thanks,
>Peter Kane, pkane_at_cisco.com
-- Andrew Finkenstadt, Vista-Chrome, Inc., Homes & Land Publishing Corporation GEnie Unix RoundTable Manager, andy_at_vistachrome.com, andy_at_genie.geis.com. "[The author] neither accidentally nor intentionally omits or includes anything that could support a preconceived thesis." - C&EN 21-DEC-92 p.72Received on Tue Feb 16 1993 - 18:27:50 CET