Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 26 Oct 2004 @ 15:00:19 GMT


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


Subj:   Re: Parameterizing SQL scripts
 
From:   Jason.Fortenberry

You need to create a stored procedure and try the CALL DBC.SysExecSQL function. For example, the following insert would show you how to do a parameterized insert/select:

     REPLACE PROCEDURE UserName.Insert_Select ( IN Tablename VARCHAR(30))
      BEGIN

      CALL DBC.SysExecSQL(
      'Insert into Database.Tablename Select * from Databasename.' || :Tablename || ';');

      END;

There are quite a few requirements and restrictions involved with this. Check out the Teradata manual "SQL Reference Stored Procedures and Embedded SQL" for more info, especially Chapter 4 section titled "Using Dynamic SQL in Stored Procedures". Good luck.


--Jason



     
  <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