Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 12 Oct 2006 @ 15:02:10 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Duplicate row error
 
From:   Mishra, Tapas

  The result is Error 2802 :Duplicate row error in temp1. Why is that select statement is not giving Error 2802, but the insert statement is giving the error .  


I'm just adding my 2 cents to this query. To answer why it doesn';t show the error is simple.

When you use the INSERT..SELECT it goes for table level constraint check and it discards all the rows. Hence there is no rows processed.

However, if you go for INSERT VALUES approach. It goes for ROW LEVEL check. WHEN it goes for ROW level check it fails as SET table doesn't permit duplicate row. Hence you get the error.

Instead of writing

     insert into temp1
     (2,2);

If you write

     insert into temp1
     SELECT 2,2

Then you will not see the error again as it will get discarded by table level constraints.


Thanks,

Tapas



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023