Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: replacing values in a table from another table
"Rocky" <me_at_privacy.net> a écrit dans le message de news:c2v0kf$a7b$1_at_reader13.wxs.nl...
> Hi,
> I'm new to oracle and probably this is quite simple for most of you. I have
> 2 tables with following structure:
>
> table1:
> pr | au | value
> ----------------------
> pr1 | method | val1
> pr1 | nometh | nom1
> pr2 | method | val2
> pr2 | nometh | nom2
> pr3 | method | val3
> pr3 | nometh | nom3
>
> table2:
> pr | au | value
> ----------------------
> pr1 | method | new1
> pr2 | method | new2
> pr3 | method | new3
>
> I need to replace val1, val2, val3, ... with new1, new2, new3...
> Who can write me the correct update statement for oracle8?
> Thanks!
>
>
Something like:
update table1
set value=(select table2.value where table2.pr=table1.pr and table2.au=table1.au)
where exists (select 1 from table2 where table2.pr=table1.pr and table2.au=table1.au);
Regards
Michel Cadot
Received on Sat Mar 13 2004 - 09:02:31 CST
![]() |
![]() |