Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 29 Jul 2002 @ 23:45:42 GMT


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


Subj:   Re: Macro Possibilities?
 
From:   Fastner, Thomas A

Jason,

you can't use the tablename as a parameter in a macro (dynamic SQL).

But you could use stored procedures:

CREATE PROCEDURE new_sales_table(my_table VARCHAR(30),
                                my_database VARCHAR(30))
   BEGIN
      DECLARE MYDATE CHAR(10) ;
      DECLARE sales_columns VARCHAR(128)
         DEFAULT
           ' (item INTEGER, price DECIMAL(8,2), sold INTEGER)';

           SEL DATE INTO :MYDATE;

      CALL DBC.SysExecSQL('CREATE TABLE ' ||
               :my_database || '.TEMP' || :MYDATE
                          || :sales_columns);
   END;

Best regards,

Tom Fastner
Consultant
Teradata Certified Master
Teradata
A Division of NCR

www.ncr.com
www.teradata.com



     
  <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