Hi People,

I am writing a procedure for work but I can't seem to locate the above error. I have it declared in the correct place but yet the compiler complains about the variables in the sql_stmnt below.
There are actually two errors owner_v and table_name_v in that sql_stmnt.

Can someone look this over to see where my mistake is? I would appreciate it.

thanks

Error(31,30): PLS-00302: component 'TABLE_NAME_V' must be declared


create or replace
PROCEDURE SCHEMA_CNT IS


owner_v varchar2(100);

table_name_v varchar2(100);

sql_stmnt varchar2(4000);

cnt_val number;

CURSOR c1 IS select owner, table_name into owner_v, table_name_v from dba_tables
WHERE owner NOT IN ('SYS','SYSTEM')
GROUP BY owner, table_name;



BEGIN

FOR c1_rec IN c1 LOOP

sql_stmnt := 'select count(*) from '||c1_rec.owner_v||'.'||c1_rec.table_name_v;

EXECUTE IMMEDIATE sql_stmnt INTO cnt_val;

DBMS_OUTPUT.PUT_LINE(c1_rec.table_name_v||' has '||cnt_val||' number of rows');

END LOOP;
END;