Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 27 Feb 2003 @ 00:57:30 GMT


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


Subj:   Re: Create temp inside a macro
 
From:   Barry Hull

The only way that I'm aware of to do this is to use a "global temporary table". If you define a global temporary table definition and then in your macro simply reference that table, the table will be substantiated when it's referred to. So, if you want to create the table and load it with some rows via an insert/select, you could simply code the insert/select into the global temporary table and it will be substantiated for your session as part of the insert/select.

In this case you wouldn't need to check for the existence of the table at the beginning of the macro because it will exist (if it doesn't, it will automatically be created). If there is a chance that the table will still contain rows and you want to make sure it's empty, put a "delete all" at the beginning of your macro.

You can set the global temporary table up to delete rows automatically at the end of the unit of work or keep the rows. In any case, the substantiated instance for your session will disappear once you end your session.

Don't know if this is what you're looking for, but I hope it helps.

Barry



     
  <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