Dynamic SQL

From: Jacqui Spencer <jacqui.spencer_at_lancscc.gov.uk>
Date: Tue, 21 Nov 2000 15:41:19 -0000
Message-ID: <3a1aa5a3$1_at_news.norweb.net>


I have a procedure in dev2000 procedure builder, along the lines of :-

declare

     cursor c1 is
          select table_name
          from  merge_tables;

    tab_name varchar2(30);

     cursor c2 is
          select col_name
          from  merge_tables
          where  table_name = tab_name;

begin
for r1 in c2 loop

        tab_name    := r1.table_name;
        for r2 in c2 loop
               statement := 'insert into table
                                  (select col_name from tab_name)';

                dbms_sql.do_sql(statement);
        end loop;

end loop;

end;

Column_name and tab_name are variable depending on what the cursors bring back. This procedure works a treat in procedure builder. My problem is that I want the users to be able to run this statement and then report on the results and I seem to be unable to do the same thing in either forms5.0 or as a stored procedure. I've tried forms_ddl in form builder, but seem unable to commit the results. Has anyone got any ideas ?

Thanks for any help
Jacqui Received on Tue Nov 21 2000 - 16:41:19 CET

Original text of this message