Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: INSERT, UPDATE
Jean-Yves LE STRAT wrote in message <3662BB2F.A827749E_at_comx.fr>...
>...
>structure of tab1 and tab 2 are identical :
>ch1 VARCHAR2(5)
>ch2 VARCHAR2(5)
>ch3 VARCHAR2(10)
>ch4 VARCHAR2(3)
>
>the primary key is (ch1, ch2, ch3, ch4)
>
>i'd like to insert new rows into tab1 and
>i'd like to update rows with new values
>...
>But to UPDATE i don't known well ... thanks to help me
All your columns are included in primary key. I don't understand what do you want to update. But here is example in suggestion that primary key is (ch1, ch2, ch3) and ch4 must be updated.
UPDATE tab1
SET ch4=
(SELECT tab2.ch4 FROM tab2
WHERE tab1.ch1 = tab2.ch1 AND tab1.ch2 = tab2.ch2 AND tab1.ch3 =
tab2.ch3)
WHERE
TS(
SELECT 1 FROM tab2
WHERE tab2.ch1 = tab1.ch1 AND tab2.ch2 = tab1.ch2 AND tab2.ch3 = tab1.ch3);
Received on Fri Dec 04 1998 - 09:59:32 CST