RE: update statement
Date: Thu, 17 Feb 2011 15:31:40 -0500
Message-ID: <6B3493ABEE194842A8EFC3FC3B23DE6A2693028BAD_at_MSXMBCCR2.roswellpark.org>
Ok, that seems to be working, it didn't error.....I thought I tried that in one of my earlier attempts. Now it's just going to run for days........
ciao,
Brian
From: Jeffrey Beckstrom [mailto:JBECKSTROM_at_gcrta.org] Sent: Thursday, February 17, 2011 3:16 PM To: oracle-l-freelists; Zelli, Brian
Subject: Re: update statement
In the "SET" you are not referencing the master table. You need an alias on the master and use it in the where clauses.
Jeffrey Beckstrom
Database Administrator
Greater Cleveland Regional Transit Authority
1240 W. 6th Street
Cleveland, Ohio 44113
>>> "Zelli, Brian" <Brian.Zelli_at_RoswellPark.org> 2/17/11 3:06 PM >>>
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-lReceived on Thu Feb 17 2011 - 14:31:40 CST