 |
 |
Archives of the TeradataForum
Message Posted: Wed, 02 Aug 2006 @ 19:14:47 GMT
Subj: | | Re: Stored Procedure to Create Grant Statements |
|
From: | | John Graas |
The following example illustrates the use of dynamic SQL statements within a stored procedure:
CREATE PROCEDURE new_sales_table (my_table VARCHAR(30),
my_database VARCHAR(30))
BEGIN
DECLARE sales_columns VARCHAR(128)
DEFAULT '(item INTEGER, price DECIMAL(8,2) ,
sold INTEGER)' ;
CALL DBC.SysExecSQL('CREATE TABLE ' || my_database ||
'.' || my_table || sales_columns) ;
END;
jdg
www.jgraas.com
| |