Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 28 Jan 2002 @ 17:55:50 GMT


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


Subj:   Using a variable for a table name in Stored Procedure
 
From:   Girija Subramanya

Hi,

Is it possible to use a variable for a table name in the FROM clause? I get the following error when I compile this SP.

SPL1027:E(L11), Missing/Invalid SQL statement'E(3707):Syntax error, expected something like a name between the 'From' keyword and ':'.

replace procedure sp_test_insert()
BEGIN

DECLARE tname CHAR(30);
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;

Appreciate any help with this.


Thanks,

girija



     
  <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