Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 12 Sep 2003 @ 15:14:19 GMT


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


Subj:   Re: Stored Procedure parms
 
From:   Dieter Noeth

Narayan Murthy K S wrote:

  But, can the SELECT in the INSERT/SELECT clause have something like :  


  'Insert into tab1 SELECT ' || colParam || ' FROM ' || tabParam ';';  


  {where colParam1 and tabParam are parameters passed to the stored procedure} The above is what I referred to as restriction.  


.
  I had a try of the above a long time back - the only resolution to the problem that I could find, is what I stated in my first reply{Store the string, export to a file and run the file }.  



I can't remember if there was that kind of restriction, but maybe you should try it again:

create table foo( i int);

replace procedure insfoo(IN tablename VARCHAR(30), IN colname
VARCHAR(30))
begin
    CALL DBC.SysExecSQL(
     'insert into foo select '
     || :colname || ' from '
     || :tablename || ';');
end;

call insfoo('sys_calendar.calendar', 'day_of_calendar');

sel * from foo;

drop table foo;

Dieter



     
  <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