Click here to Skip to main content
15,893,594 members
Home / Discussions / Database
   

Database

 
Questionunresolved external symbol sqlcxt Pin
ravi1204868-Jun-10 1:02
ravi1204868-Jun-10 1:02 
AnswerRe: unresolved external symbol sqlcxt Pin
Chris Meech8-Jun-10 7:14
Chris Meech8-Jun-10 7:14 
QuestionTriggers Pin
Morgs Morgan7-Jun-10 3:28
Morgs Morgan7-Jun-10 3:28 
AnswerRe: Triggers Pin
Mycroft Holmes7-Jun-10 4:33
professionalMycroft Holmes7-Jun-10 4:33 
GeneralRe: Triggers Pin
Morgs Morgan7-Jun-10 5:42
Morgs Morgan7-Jun-10 5:42 
AnswerRe: Triggers Pin
dan!sh 7-Jun-10 5:16
professional dan!sh 7-Jun-10 5:16 
AnswerRe: Triggers Pin
Tim Carmichael7-Jun-10 5:49
Tim Carmichael7-Jun-10 5:49 
QuestionNeed help with an oracle UPDATE [modified] Pin
Kalyan_A6-Jun-10 23:02
professionalKalyan_A6-Jun-10 23:02 
I have two tables with the following structure.

Table 1

Name Field1

n1       a
n2       b
n2       c
n3       d


Table 2

ID Name Field1

1    n1     NULL
2    n2     NULL	
3    n3     NULL


Usually, Table1.Name and Table1.Field1 have a 1..1 relationship. however in very-rare circumstances they do tend to have 1..n

I need to update Table2.Field1 with Table1.Field1; In SQL Server we could write the following update statement to satisfy our business conditions.

UPDATE Table2 SET Table2.Field1 = T1.Field1<br />
	FROM Table1 t1, Table2 t2<br />
	WHERE t1.Name = t2.Name;<br />


In oracle, we were having the below statement.

UPDATE Table2 SET Field2 = (SELECT t1.FIELD1 FROM Table1 t1, Table2 t2<br />
	WHERE t1.Name = t2.Name);



This statement works for Table1 having 1..1 relationship between Table1.Name and Table1.Field1
For 1..n relationship the ORACLE version fails with the following error - ORA-01427: single-row subquery returns more than one row

The SQLServer sql works for both the cases 1..1 and 1..n; given the nature of the join.

Could someone guide me with appropriate sql for the above issue?
I am looking for a bulk update statement rather than using PL/SQL to go through each recrod in Table2.

Thanks for your help.
Kalyan

modified on Monday, June 7, 2010 10:55 AM

AnswerRe: Need help with an oracle UPDATE Pin
Mycroft Holmes6-Jun-10 23:33
professionalMycroft Holmes6-Jun-10 23:33 
GeneralRe: Need help with an oracle UPDATE Pin
Kalyan_A6-Jun-10 23:41
professionalKalyan_A6-Jun-10 23:41 
GeneralRe: Need help with an oracle UPDATE Pin
Mycroft Holmes7-Jun-10 0:53
professionalMycroft Holmes7-Jun-10 0:53 
GeneralRe: Need help with an oracle UPDATE Pin
Kalyan_A7-Jun-10 5:12
professionalKalyan_A7-Jun-10 5:12 
AnswerRe: Need help with an oracle UPDATE Pin
David Skelly7-Jun-10 2:50
David Skelly7-Jun-10 2:50 
GeneralRe: Need help with an oracle UPDATE Pin
Kalyan_A7-Jun-10 5:11
professionalKalyan_A7-Jun-10 5:11 
QuestionRTF to TEXT Pin
Sebastian T Xavier6-Jun-10 20:45
Sebastian T Xavier6-Jun-10 20:45 
AnswerRe: RTF to TEXT Pin
Mycroft Holmes6-Jun-10 23:29
professionalMycroft Holmes6-Jun-10 23:29 
GeneralRe: RTF to TEXT Pin
Sebastian T Xavier6-Jun-10 23:40
Sebastian T Xavier6-Jun-10 23:40 
GeneralRe: RTF to TEXT Pin
Sebastian T Xavier6-Jun-10 23:43
Sebastian T Xavier6-Jun-10 23:43 
AnswerRe: RTF to TEXT Pin
J4amieC6-Jun-10 23:42
J4amieC6-Jun-10 23:42 
GeneralRe: RTF to TEXT Pin
Sebastian T Xavier6-Jun-10 23:51
Sebastian T Xavier6-Jun-10 23:51 
GeneralRe: RTF to TEXT Pin
Mycroft Holmes7-Jun-10 0:56
professionalMycroft Holmes7-Jun-10 0:56 
GeneralRe: RTF to TEXT Pin
Sebastian T Xavier7-Jun-10 1:22
Sebastian T Xavier7-Jun-10 1:22 
GeneralRe: RTF to TEXT Pin
Mycroft Holmes7-Jun-10 1:30
professionalMycroft Holmes7-Jun-10 1:30 
GeneralRe: RTF to TEXT Pin
Eddy Vluggen7-Jun-10 1:59
professionalEddy Vluggen7-Jun-10 1:59 
GeneralRe: RTF to TEXT Pin
Sebastian T Xavier7-Jun-10 3:19
Sebastian T Xavier7-Jun-10 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.