title: SQL create table use %type at column
body: <p>I'm trying to create a backuptable of one of my tables (in a function),</p>
  
  <pre><code>CREATE TABLE TBTestBackup
             (
               colum1           user.TBTest.colum1%type,
               colum2           user.TBTest.colum2%type,
               colum3           user.TBTest.colum3%type
               colum31           user.TBTest.colum3%type, --new column with same type as colum3
               colum4           user.TBTest2.column15type, --column from other table
               colum4           CHAR    (12 BYTE), --new column with fixed type
             ) TABLESPACE user_DATA
  </code></pre>
  
  <p>But I red this won't work,
  now my question is how could I make this as much dynamic as possible so I don't have to update the datatypes at the backup script every time I change a datatype e.g. from:</p>
  
  <p><code>VARCHAR2(24 CHAR)</code> to <code>VARCHAR2(50 CHAR)</code> </p>
  
  <p>(the table-columns are fixed they wont change)
  this doesn't happen often but we had to do it some times because the field wasn't great enough for a specific value and then nobody updated the backup-table and id gave some errors.</p>
  
  <p>EDIT: I forgot something necessary:</p>
  
  <ul>
  <li>I have to add 2 columns that aren't in the original table, but should have the same datatype as one of the already existing tables.
  could I use select as so it will have the same type but another name?
  if yes how do I do that?</li>
  <li>and some fields that are from a different table (so I have to use joins)</li>
  </ul>
  
  <p>SUM:</p>
  
  <ul>
  <li>Multiple columns with type from multiple tables</li>
  <li>New Column with fixed Type</li>
  <li>New Column with variable type like colum XY from table ABC</li>
  </ul>