Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: when is a variable not a variable
bach_at_panix.com (John Steinbach) wrote:
>PROCEDURE count_tables IS
>v_name CHAR(20);
>v_count INTEGER;
>CURSOR c_tables IS
> SELECT table_name
> FROM user_tables
> WHERE tabelspace_name = 'tablespacename';
>BEGIN
>
> FOR x IN c_tables LOOP
> v_name := x.table_name;
> SELECT COUNT(*) INTO v_count
> FROM v_name;
>
> INSERT INTO table_count(table_name,count)
> VALUES(v_name,v_count);
> ENND LOOP;
>END;
>
>
Hi there,
You are trying to execute a dynamic sql statement in your plsql block. You need to open a cursor, then parse it and then execute it. You need to use DBMS_SQL.open_cursor. I am not sure of the syntax, Atpresent I am at my residence, I will forward you from the office tomorrow.
Regards
N.Prabhakar Received on Wed Jan 29 1997 - 00:00:00 CST