title: How to generate spool file in my local folder
body: <p>I want to generate a spool file with a file name and store it into my local folder whose path I can provide in the code itself. How to do that? Suppose below is the code where I want script to be generated in the separate SQL file</p>
  <pre><code>declare
   lv_str varchar2(1000);
  begin
  for c in(select distinct a.table_name as table_name, 
                  b.table_name as parent_table_name ,
                  a.owner
             from all_constraints a, 
                  all_constraints b 
            where a.r_constraint_name = b.constraint_name 
              and a.constraint_type   = 'R'
              and b.constraint_type   = 'P'
              and a.owner             = b.owner   -- if parent and child belongs to the same schema
              and a.owner             = 'SCOTT'
         ) loop
   lv_str :='DROP TABLE ' || c.owner || '.' || c.table_name || '; -- ' || c.parent_table_name;
   dbms_output.put_Line (lv_str );
   end loop;
  end;
  </code></pre>
  <p>/</p>
  <p>Also, one small help If I want to drop the table names would it require deleting the parent table as well. If yes, how to delete table_name and parent_table_name?(as per the code) at once.</p>