Im trying to write a procedure that will return the rowcount of any table whose name is supplied as avariable to the function. I know it is possible to include a variable in the where clause of a cusor but I seem to have problems including a variable in the from clause:
create or replace procedure RowComparison is
cursor tableName_cur is
select table_name from user_tables;
FETCH tableName_cur into tableName_rec;
EXIT WHEN tableName_cur%NOTFOUND;
select count(*) into raph1count from tableName_rec. table_name;
I get the same problem if I try to rewrite this using an explicit cursor.
The error I get is this:
PLS-00356: 'TABLENAME_REC.TABLE_NAME' must name a table to which the user has access
Can anyone help?
Click Here to Expand Forum to Full Width