Archives of the TeradataForum
Message Posted: Tue, 26 Oct 2004 @ 15:00:19 GMT
Subj: | | Re: Parameterizing SQL scripts |
|
From: | | Jason.Fortenberry |
You need to create a stored procedure and try the CALL DBC.SysExecSQL function. For example, the following insert would show you how to do a
parameterized insert/select:
REPLACE PROCEDURE UserName.Insert_Select ( IN Tablename VARCHAR(30))
BEGIN
CALL DBC.SysExecSQL(
'Insert into Database.Tablename Select * from Databasename.' || :Tablename || ';');
END;
There are quite a few requirements and restrictions involved with this. Check out the Teradata manual "SQL Reference Stored Procedures
and Embedded SQL" for more info, especially Chapter 4 section titled "Using Dynamic SQL in Stored Procedures". Good luck.
--Jason
|