Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: use of variables in pl/sql

Re: use of variables in pl/sql

From: Quinton McCombs <quintonm_at_bellsouth.net>
Date: Tue, 03 Nov 1998 16:03:54 GMT
Message-ID: <363F29CC.E6A618BB@bellsouth.net>


You need to use dynamic sql for this. I forget the exact syntax when it comes to returning rows, but you can find it in the Oracle Application Developer's Guide.

Peter Shankey wrote:
>
> Given the block:
>
> declare
> cursor tab_cursor is select table_name from sys.dba_tables where
> owner = 'CHADBA';
> my_table_name varchar2(30);
> BEGIN
> open tab_cursor;
> loop
> fetch tab_cursor into my_table_name;
> exit when tab_cursor%notfound;
> dbms_output.put_line('table name is: ' || my_table_name);
> select * from my_table_name;
> end loop;
> close tab_cursor;
> END;
> /
>
> Why can not I substiutue the var my_table_name on the select statement
> and get a dump of the tables? Is there a way to do this?
Received on Tue Nov 03 1998 - 10:03:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US