Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Probably simple sql question
Doug,
Your logic is basically correct however you are selecting values from B
which match
a value in A - if no record is found that matches on primary key you will
have nothing
returned from the sub-query and hence will attempt to see B.offset to NULL.
Try this
Update B set offset =
(select offset from A where A.primarykey = B.primarykey) WHERE EXISTS ( select '1' from A where A.primarykey = B.primarykey)
The where will prevent any B's being updated unless there is a match in A - messy I know.
--
Regards
Martin Jones
OCP - DBA OCP - Application Developer ---------------------------------------------Doug Cowles <dcowles_at_bigfoot.com> wrote in message news:37445359.7644AB94_at_bigfoot.com...
![]() |
![]() |