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...


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 Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016