|
|
Archives of the TeradataForum
Message Posted: Fri, 12 Sep 2003 @ 15:14:19 GMT
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
| |