Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 10 May 2002 @ 13:29:01 GMT


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


Subj:   Re: Where clause in insert macro
 
From:   Geoffrey Rommel

  And I believe you can't have a WHERE clause when you are using the VALUES clause.  



Right. How could you? WHERE examines the values in existing rows of the table, but insert adds a new row. Moreover, when WHERE is specified, some rows may meet the condition and others may not. Single-row insert, however, is unconditional: if you don't want the new row, you just don't perform the insert.

And another thing! A statement that would in effect be "if (some-condition) then insert, else do nothing" would introduce sequential logic into SQL, which generally should be avoided. (Yes, I know, the CASE expression is sequential.) Let's try to keep SQL as relationally pure as we can.


--wgr



     
  <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