Archives of the TeradataForum
Message Posted: Fri, 22 Nov 2002 @ 15:19:17 GMT
Subj: | | Syntax error in Stored Procedure |
|
From: | | Syed Arifuddin |
I am trying to use variable content in FROM clause of select statement but it gives me error message saying "syntax error expecting
something like a name between a from keyword and :"
This is the procedure which i am creating.
replace procedure mydb.listtables()
begin
declare rowcount int;
declare tablenames varchar(100);
CALL DBC.SysExecSQL('create table mydb.tableinfo(TableName varchar (100),Rowcount int)');
for row_cursor as row_cursor1 cursor for
select TableName from dbc.tables where TableKind='T' DO
set tablenames = row_cursor.Tablename;
CALL DBC.SysExecSQL('SELECT COUNT(*) INTO :rowcount from :TableNames');
insert into arifdb.tableinfo values(:row_cursor.TableName,:rowcount);
END FOR;
end;
Your help will be appreciated in this regard.
Thanks.
Syed.
|