  |  
  |  
 
Archives of the TeradataForum 
 
 
Message Posted: Fri, 10 May 2002 @ 13:29:01 GMT 
 
  
 
 
 
 
  
|  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 
 
 
 
 
   
 
 |   |