Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 25 Oct 2002 @ 22:46:13 GMT


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


Subj:   Re: Variables as Table Name(s) in Stored Procedure
 
From:   Jason Fortenberry

I had this same question a while back and received the following answer which worked for me and so I now forward on....

You could attempt something similar to the example quoted in "Teradata RDBMS SQL Reference Volume-6" on Dynamic SQL statements within a stored procedure

CREATE PROCEDURE new_sales_table(my_table VARCHAR(30), my_database VARCHAR(30))
BEGIN

DECLARE sales_columns VARCHAR(128)
DEFAULT '(item INTEGER, price DECIMAL(8,2), sold
INTEGER)';

CALL DBC.SysExecSQL('CREATE TABLE ' || :my_database || '.' || :my_table || :sales_columns);

END;


     
  <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