Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Need Simple Query Help

Re: Need Simple Query Help

From: KeyStroke (Jack L. Swayze Sr.) <KeyStrk_at_Feist.Com>
Date: Wed, 02 Dec 1998 19:36:59 -0600
Message-ID: <3665EB3B.950AB2BF@Feist.Com>


not being there, I can't tell if this will work or not but try this:

update addressbook2 set pin =
(select pin from phonebook where phonebook.firstname=addressbook2.firstname and
phonebook.lastname=addressbook2.lastname) where (addressbook2.firstname, addressbook2.lastname) IN (select firstname, lastname from phonebook)
;

MN wrote:

> I'm trying compare two table in Oracle and with a firstname and lastname
> matches fill-in a pager pin number.
>
> This is the sql statement I'm running
>
> update addressbook2 set pin =
> (select pin from phonebook where phonebook.firstname=addressbook2.firstname
> and
> phonebook.lastname=addressbook2.lastname)
> where addressbook2.firstname IN (select firstname from phonebook)
> and addressbook2.lastname IN (select lastname from phonebook)
>
> but I get an error message saying:
> ORA-01427: single-row subquery returns more than one row
>
> My question is can I update the table even when there are duplicates in
> the tables. The query runs perfect when both tables are unique.
>
> Thank you for any help.
>
> MN
Received on Wed Dec 02 1998 - 19:36:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US