Home Page for the TeradataForum
 
 

 

Archives of the TeradataForum





Message Posted: Mon, 28 Jan 2002 @ 19:58:48 GMT





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




Subj:   Re: Using a variable for a table name in Stored Procedure
 
From:   Dennis Calkins



Subramanya, Girija wrote:

  SET tname = 'my_table';

INSERT INTO dba.process_table (process_id,process_name)
SELECT
Process_ID,
Process_Name
From :tname
Where process_date = DATE;
END;
 



Hi,

this is Dynamic SQL. It is now avialble in Teradata V2r4.1.

    CALL DBC.SysExecSQL(
       'INSERT INTO dba.process_table (process_id,process_name)
        SELECT Process_ID, Process_Name From ' || :tname ||
       'Where process_date = DATE;');

The exact syntax can be found in

Chapter 4 of the Teradata RDBMS SQL Reference - Volume 6 Data Manipulation Statements

www.info.ncr.com/sd/sd-1.cfm?page=td


click on Sql Reference and then find Volume 6 of release 4.1.x.


Please let me know if you need





     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
 
  Top Home Join Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky 
Last Modified: 30 Jun 2008