Re: update statement

From: Igor Neyman <igor.neyman_at_gmail.com>
Date: Thu, 17 Feb 2011 15:20:21 -0500
Message-ID: <AANLkTintA6Nzur+HyTvWD7vj_5pxQ7kJizvH0yO4ZGch_at_mail.gmail.com>



Oops!
Disregard my previous message.

On Thu, Feb 17, 2011 at 3:17 PM, Igor Neyman <igor.neyman_at_gmail.com> wrote:

>
> Probably your "FROM" clause should be "annmarie" and not "annmarie.
> s_subject"
> How about:
>
> UPDATE s_subject
> SET u_mrn = (SELECT u_mrn FROM annmarie
> WHERE annmarie.s_subject.s_subjectid = s_subject.s_subjectid)
> where exists
>
> (SELECT u_mrn FROM annmarie
> WHERE annmarie.s_subject.s_subjectid = s_subject.s_subjectid);
>
> Regards,
> Igor Neyman
>
> On Thu, Feb 17, 2011 at 3:12 PM, Zelli, Brian <Brian.Zelli_at_roswellpark.org
> > wrote:
>
>> yes
>>
>>
>>
>>
>> ciao,
>>
>> Brian
>>
>>
>>
>>
>> ------------------------------
>> *From:* Igor Neyman [mailto:igor.neyman_at_gmail.com]
>> *Sent:* Thursday, February 17, 2011 3:13 PM
>> *To:* Zelli, Brian
>> *Cc:* oracle-l-freelists
>> *Subject:* Re: update statement
>>
>> Is s_subjectid - a key in both: s_subject and annmarie tables?
>>
>> Regards,
>> Igor Neyman
>>
>> On Thu, Feb 17, 2011 at 3:06 PM, Zelli, Brian <
>> Brian.Zelli_at_roswellpark.org> wrote:
>>
>>> SQL> UPDATE s_subject
>>> 2 SET u_mrn = (SELECT u_mrn FROM annmarie.s_subject
>>> 3 WHERE annmarie.s_subject.s_subjectid = s_subject.s_subjectid)
>>> 4 where exists
>>> 5 (SELECT u_mrn FROM annmarie.s_subject
>>> 6 WHERE annmarie.s_subject.s_subjectid = s_subject.s_subjectid);
>>> SET u_mrn = (SELECT u_mrn FROM annmarie.s_subject
>>> *
>>> ERROR at line 2:
>>> ORA-01427: single-row subquery returns more than one row
>>>
>>> Ok, I am trying to update the mrn data based on the subjectid's being
>>> equal. It errors saying:
>>> This is a key and there shouldn't be any duplicates. An example I saw
>>> uses the same code.
>>>
>>> What is wrong with the code?
>>>
>>>
>>>
>>> Brian
>>>
>>>
>>>
>>> This email message may contain legally privileged and/or confidential
>>> information. If you are not the intended recipient(s), or the employee or
>>> agent responsible for the delivery of this message to the intended
>>> recipient(s), you are hereby notified that any disclosure, copying,
>>> distribution, or use of this email message is prohibited. If you have
>>> received this message in error, please notify the sender immediately by
>>> e-mail and delete this email message from your computer. Thank you.
>>
>>
>>
>> This email message may contain legally privileged and/or confidential
>> information. If you are not the intended recipient(s), or the employee or
>> agent responsible for the delivery of this message to the intended
>> recipient(s), you are hereby notified that any disclosure, copying,
>> distribution, or use of this email message is prohibited. If you have
>> received this message in error, please notify the sender immediately by
>> e-mail and delete this email message from your computer. Thank you.
>>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Feb 17 2011 - 14:20:21 CST

Original text of this message