Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 19 Sep 2002 @ 13:06:29 GMT


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


Subj:   Re: Case Statement in Macro
 
From:   Geoffrey Rommel

  Your macro starts with a CASE statement which is not an SQL Statement. Case can be used as part of a statement but not a statement in its own right.  



Right. CASE ... END is an expression, not a statement. However, in V2R4.1, there is also a case statement (CASE ... END CASE;), which can be used only in stored procedures, not macros. See the SQL Reference, Vol. 6, ch. 4, p. 4-43.

Now let's review....

Expressions always have a value; statements do not (not in SQL, anyhow). Expressions do not do anything; statements do something (they are commands). Expressions can be terms in larger expressions; statements cannot (e.g., you cannot add one statement to another).

These are expressions:

5
(m * n) + p
a == b
CASE when a=b then 'Equal' else 'Not Equal' END


These are statements:

x = 5;
z = (m * n) + p;
if (a == b) { printf("They're equal\n"); }
select CASE when a=b then 'Equal' else 'Not Equal' END from your.table;



     
  <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