title: Combining 3 steps into one SQL script
body: <p>I'm pretty new to SQL, so it sould be rather easy to answer my questions.</p>
  
  <p>Here is what I want to do:</p>
  
  <ol>
  <li><p>Deactivate constraints:  </p>
  
  <p>Deactivate constraints in the database:  </p>
  
  <pre><code>begin
      for cur in (select fk.owner, fk.constraint_name , fk.table_name 
             from all_constraints fk, all_constraints pk 
             where fk.CONSTRAINT_TYPE = 'R' and 
                   pk.owner = 'USER1' and
                   fk.R_CONSTRAINT_NAME = pk.CONSTRAINT_NAME ) loop
          execute immediate 'ALTER TABLE '||cur.owner||'.'||cur.table_name||' MODIFY CONSTRAINT '||cur.constraint_name||' DISABLE';
      end loop;
  end;  
  </code></pre></li>
  <li><p>Delete from tables:   </p>
  
  <pre><code>delete from USER_TEST.Table1;                
  delete from USER_TEST.Table2;               
  delete from USER_TEST.Table3; 
  </code></pre></li>
  <li><p>Reactivate Constraints:  </p>
  
  <pre><code>begin
    for cur in (select fk.owner, fk.constraint_name , fk.table_name 
                from all_constraints fk, all_constraints pk 
                where fk.CONSTRAINT_TYPE = 'R' and 
                      pk.owner = 'USER1' and
                      fk.R_CONSTRAINT_NAME = pk.CONSTRAINT_NAME ) loop
         execute immediate 'ALTER TABLE '||cur.owner||'.'||cur.table_name||' MODIFY CONSTRAINT '||cur.constraint_name||' ENABLE NOVALIDATE';
     end loop;
  end; 
  </code></pre></li>
  </ol>
  
  <p>Does anyone know how to combine these steps into one <code>.sql</code> script so I can run this on Oracle SQLDeveloper? Or maybe a more elegant way to perform the deletion from the tables? </p>
  
  <p>I'd be very thankful</p>