pl/sql simple prob but .....

From: Ravi Rai <ravirai_at_winternet.com>
Date: 1996/01/23
Message-ID: <4e3h8g$137_at_blackice.winternet.com>#1/1


Hi

I am very new to PL/SQL. I wrote this program to see if I can use variables for table names. But I always end up in error.

I appreciate any feedback.



create or replace procedure rktest as
cursor tbl_name is

   select table_name
   from user_tables
   order by table_name;

rec_count number;

begin

  dbms_output.put_line(' ************* ');
  DBMS_OUTPUT.PUT_LINE ('');
  DBMS_OUTPUT.PUT_OUTPUT.PUT_LINE ('');

    for lp_val in tbl_name loop
      select count (*) 
      into rec_count 
      from lp_val.table_name#;

      DBMS_OUTPUT.PUT_LINE ('Table :'||lp_val.table_name);
      DBMS_OUTPUT.PUT_LINE ( ' recs: ' || rec_count);
      DBMS_OUTPUT.PUT_LINE ('');

    end loop;
end rktest;
/
compilation Error:
15/10 PLS-00356: 'LP_VAL.TABLE_NAME' must name a table to which the

         user has access


Thanks

Ravi Received on Tue Jan 23 1996 - 00:00:00 CET

Original text of this message