Hi,
I don't know if this bug is already fixed in newer versions than that we
use.
I have a table with the following values inserted:
create table table1 ( col1 date not null primary key, col2 integer null )
//
insert into table1 values ( '2003-01-01', 1 )
//
insert into table1 values ( '2003-01-02', 3 )
//
insert into table1 values ( '2003-02-01', 7 )
//
Now I want to copy the values of January to February. To avoid collisions
with existing entries in Feb I exclude the corresponding entries:
insert into table1
select adddate(col1, 31), col2
from table1
where col1 between '2003-01-01' and '2003-01-31'
and adddate(col1, 31) not in
( select col1
from table1
where col1 between '2003-02-01' and '2003-02-28' )
If I made no mistake this should run without collision and the entry
('2003-01-02', 3) should be copied to ( '2003-02-02', 3 ).
But instead I get "duplicate key". So I assume that the subquery is not
evaluated correctly or the result isn't used correctly.
If I execute the subquery separately and then use the result instead of the
subquery it works fine!
select col1
from table1
where col1 between '2003-02-01' and '2003-02-28'
Resultset: ('2003-02-01')
insert into table1
select adddate(col1, 31), col2
from table1
where col1 between '2003-01-01' and '2003-01-31'
and adddate(col1, 31) not in
( ('2003-02-01') )
Comments?
Thanks in advance,
Florian Kaerner
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general