[Info-Ingres] Ambiguous replace?
Tim Ellis
tellis3 at csc.com
Fri Apr 6 05:17:01 CDT 2007
I am puzzled - I'm either overlooking something blindingly obvious, or
have found something very strange.
I am trying to update one view from another.
View_A is of the form:-
Select * from Table_A where Column_1 = ' '
View_B is of the form:-
Select * from Table_B z where not exists
(select 1 from Table_B y
where z.column_2 = y.column_2
and z.column_3 = y.column_3
and z.column_1 != y.column_1)
(Table_B.Column_1 is a unique key)
If I run the following bit of SQL
Select * from View_A a, View_B b
where a.Column_2 = b.Column_2
and a.column_3 = b.column_3
and a.column_2 like 'Q%'
and b.column_2 like 'Q%'
then I get back two rows - They have the same value for column_1 but
different values for
column_3 and View_B.Column_1
However if I run
Update VIew_A a from view B b
Set Column_1 = b.Column_1
where a.Column_2 = b.Column_2
and a.column_3 = b.column_3
and a.column_2 like 'Q%'
and b.column_2 like 'Q%'
I get:-
E_US125D Ambiguous replace: you have specified several replacements
for
the same row.
Surely if I had several replacements for the same row I would see this
in the original select.
If I take the value of Column_2 from my original query (say 'Q1234')
and look for this on either the views or the base tables
Select * from View_A where column_2 = 'Q1234';
Select * from View_B where column_2 = 'Q1234';
Select * from Table_A where column_2 = 'Q1234';
Select * from Table_B where column_2 = 'Q1234';
In each case I get two rows - these two rows have distinct values of
column_3, so where is the ambiguous replace coming from?
More information about the Info-Ingres
mailing list