Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 21 May 2009 @ 09:57:27 GMT


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


Subj:   Re: Create Statement in Macro
 
From:   McCall, Glenn David

  I am creating a Volatile table in Macro and Inserting the data into table. My system is running in ANSI mode. While creating a Macro it throws a warning message.  


  3576: Data Definition not valid unless solitary  


  I saw in one of the document multistatements with Macro causes the above kind of warning. Is there any way that I can accomplish.  


A data definition statement (create, drop, alter etc) must be the last statement in a transaction.

When you exec a macro all of the queries within it are run as a single transaction. Hence your create table must be at the end. Yes, I know that isn't much use if you need to load data into it in your macro.

I don't know why the data definition must be last, but it just does. If it isn't, you will get the error you are reporting.

So what can you do?

Instead of using a volatile table, try using a global temporary table. Global Temporaries essentially work the same as volatile tables except the definition is permanent (the content, like volatile tables, is still private to your session).

You could also create the volatile table before running your macro.

Another possibility is to wrap the whole process in a Stored Procedure. In this model the procedure will create the volatile table then it could exec your macro.

I hope this gives you some ideas, I'm sure the list would be interested in what you finally decided to do.


Glenn Mc



     
  <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