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 -> sqlplus: starting multiple procedures by a dynamic file name

sqlplus: starting multiple procedures by a dynamic file name

From: Govna <agd22_at_drexel.edu>
Date: 26 Sep 2001 20:15:20 -0700
Message-ID: <16f3c0b2.0109261915.674d97a9@posting.google.com>


The purpose of this is to simply delete test data from the tables (alleviates primary key confliction) and execute other .sql files (individual templates) to load new test data.

I would appreciate help with executing code along these lines...  (the variables in v_filename are in the local directory.)

This program is called using sqlplus:
SQL> @the_script

##################Inside the_script#################################
Declare
  v_filename varchar2 (40);
Begin

   for v_counter in 1..20 loop

      delete from table1 where primarykey = v_counter;
      delete from table2 where primarykey = v_counter;
      delete from table3 where primarykey = v_counter;

      v_filename := '@' || v_counter || '.sql';

--Now here is the tricky part....
--How do i execute a "start" or "@" on a variable ?
--This next line does not work:

      execute @v_filename;
   end loop;
end;
/

PS. Feel free to flame about not reading manuals and being a noob :P

Tanks for your help. Received on Wed Sep 26 2001 - 22:15:20 CDT

Original text of this message

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