title: PL/SQL script to rename tables using select statement
body: <p>Hey all I am tasked to write a script to rename tables. All though this sounds easy, there are a few other things to keep in mind. There is a table which contains all of the other tables which will need name changing. Something along the lines of Table consists of 3 columns, first column is unpartitionednm, second is originalnm, third partitionedtablenm.  I was told to use a select statement to select two tables, then use those tables to alter the names.  This is what I have so far:</p>
  
  <pre><code>declare
  begin
    execute immediate 'select unpartitiontablenm "table1", originaltablenm "table2"
                       from tabletransformation                     
                       alter table table1
                       rename to table2';
  end;
  </code></pre>
  
  <p>Now I tried to send him other ways to do this, such as a renaming parameter and just a simple script to accept which two tables he would like to rename but all those he did not want. Maybe I just dont understand why this way is better but oh well, what can you do when you need a paycheck.  Anyways, I need some help understand exactly what he would like me to do and how far off I am from it.  Thanks in advance.</p>
  
  <p><em>I understand the above code is wrong but it might give you a better understanding of how he described it to me.</em></p>