Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

table name as variable in loop

the_slkSep 16 2009 — edited Nov 27 2010
Hallo

I'm trying to use code like:

DECLARE
CURSOR cv_table IS SELECT table_name FROM user_tables WHERE table_name LIKE 'TEST%';
v_table_name CHAR(16);
BEGIN
OPEN cv_table;
LOOP
EXIT WHEN cv_table%NOTFOUND;
FETCH cv_table INTO v_table_name;
select * from v_table_name where rownum<2;
END LOOP;
END proc_cs_fast_stats;


Error report:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:

any ideas? thanks a lot for answer.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 25 2010
Added on Sep 16 2009
21 comments
32,237 views