Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sun, 20 Aug 2006 @ 10:12:31 GMT


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


Subj:   Re: Question regarding error message for merge into
 
From:   Victor Sokovin

          > Merge into dummy_table as dt
          > Using (select 1 as col1, 'FALS' as col2 from s1_test) a1
          > On (a1.col1 = column1)
          > When matched then
          > Update set column2 = a1.col1
          > When nont matched then
          > Insert (column1, column2)
          > Values (a1.col1, a1.col2)
  When running this, I get the error mentioned above 5760 The SELECT subquery from the table reference must fully specify either a UPI value or else a USI value.  


Anomy, you seem to be missing the mandatory WHERE clause.

     select 1 as col1, 'FALS' as col2 from s1_test

should be rewritten to something like this:

     select 1 as col1, 'FALS' as col2 from s1_test
     WHERE COL_A = valA and COL_B = valB and ... COL_N = valN,

where (COL_A, COL_B, ..., COL_N) either comprise the UPI or a USI on s1_test.

Quite a restriction. You might need to rethink the logic of your query if, for example, you did not have UPI/USI on that table.


Regards,

Victor



     
  <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