<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: adding columns to many tables - ORACLE in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889375#M845809</link>
    <description>Hi Steve,&lt;BR /&gt;&lt;BR /&gt;Yes creating a script with the alter table statements will be an easy solution. Here is how you do it.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; set heading off&lt;BR /&gt;SQL&amp;gt; select 'Alter table  '||table_name|| '  add (name varchar2(100), address varchar2(100), phone number);' &lt;BR /&gt;   from all_tables&lt;BR /&gt; where owner =  'SRB';&lt;BR /&gt;&lt;BR /&gt;This statement will prepare alter table statements for all the tables in the schema SRB  and the output will look like this :-&lt;BR /&gt;&lt;BR /&gt;Alter table TABLE_A add (name varchar2(100), address varchar2(100), phone number);&lt;BR /&gt;Alter table TABLE_B add (name varchar2(100), address varchar2(100), phone number);&lt;BR /&gt;Alter table TABLE_B add (name varchar2(100), address varchar2(100), phone number);&lt;BR /&gt;&lt;BR /&gt;Befor you execute the above SQL statement spool to a alter_tab.sql file. Like this&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; set heading off&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;spool alter_tab.sql&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select 'Alter table  '||table_name|| '  add (name varchar2(100), address varchar2(100), phone number);' &lt;BR /&gt;   from all_tables&lt;BR /&gt; where owner =  'SRB';&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; spool off&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;set heading on&lt;BR /&gt;&lt;BR /&gt;Now you will find the sql file alter_tab.sql created in your directory. Now to execute the created alter_tab.sql do this.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;spool alter_tab_output.log&lt;BR /&gt;SQL&amp;gt;@alter_tab.sql&lt;BR /&gt;SQL&amp;gt;spool off&lt;BR /&gt;&lt;BR /&gt;Now check the alter_tab_output.log file for any errors.&lt;BR /&gt;&lt;BR /&gt;Indira A</description>
    <pubDate>Thu, 03 Mar 2005 20:07:02 GMT</pubDate>
    <dc:creator>Indira Aramandla</dc:creator>
    <dc:date>2005-03-03T20:07:02Z</dc:date>
    <item>
      <title>adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889369#M845803</link>
      <description>ORACLE - adding columns to many tables..&lt;BR /&gt;&lt;BR /&gt;We have a schema "srb" that has several tables in it that we need to add columns in all the tables in a schema.&lt;BR /&gt;&lt;BR /&gt;example&lt;BR /&gt;schema  SRB&lt;BR /&gt;&lt;BR /&gt;      TABLE  A&lt;BR /&gt;      TABLE  B&lt;BR /&gt;      TABLE  C &lt;BR /&gt;      ...&lt;BR /&gt;      TABLE  ZZZ&lt;BR /&gt;&lt;BR /&gt;           COLUMNS TO ADD IN EACH &lt;BR /&gt;&lt;BR /&gt;             NAME     VARCHAR2(100)&lt;BR /&gt;             ADDRESS  VARCHAR2(100)&lt;BR /&gt;             PHONE    NUMBER&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I know I can add one at a time but, We have a lot of tables and need to do this without doing it manually. &lt;BR /&gt;&lt;BR /&gt;Any suggestions?&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Mar 2005 14:26:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889369#M845803</guid>
      <dc:creator>Stephen Badgett</dc:creator>
      <dc:date>2005-03-03T14:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889370#M845804</link>
      <description>yep, 2 ways:&lt;BR /&gt;&lt;BR /&gt;1. write select that generates "alter table" statements, something like:&lt;BR /&gt;select "alter table " || table_name ...&lt;BR /&gt;from dict&lt;BR /&gt;wher ....&lt;BR /&gt;&lt;BR /&gt;spool it into some file and then execute it.&lt;BR /&gt;&lt;BR /&gt;2. write pl/sql procedure that executes alter table.&lt;BR /&gt;&lt;BR /&gt;But I prefer the first way.</description>
      <pubDate>Thu, 03 Mar 2005 14:40:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889370#M845804</guid>
      <dc:creator>Alex Lavrov.</dc:creator>
      <dc:date>2005-03-03T14:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889371#M845805</link>
      <description>I am not sure how to do that.&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Mar 2005 16:57:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889371#M845805</guid>
      <dc:creator>Stephen Badgett</dc:creator>
      <dc:date>2005-03-03T16:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889372#M845806</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've been an Oracle DBA for many years and believe, the first way that Alex told you is the fast and best way to do this.&lt;BR /&gt;Also, you can make some modifications in the script generated by select..., puting some promptÂ´s or dbms_output.put_line... to say what your are doing, like, "alter table xxx add column xxx number;" and spooling all output of this script to verify that everything was done.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 03 Mar 2005 17:49:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889372#M845806</guid>
      <dc:creator>Julio Yamawaki</dc:creator>
      <dc:date>2005-03-03T17:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889373#M845807</link>
      <description>I do not doubt it in any way I just do not know how to do the syntax of the statement</description>
      <pubDate>Thu, 03 Mar 2005 19:55:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889373#M845807</guid>
      <dc:creator>Stephen Badgett</dc:creator>
      <dc:date>2005-03-03T19:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889374#M845808</link>
      <description>Here it is currently -- Are we just to add the add part later?&lt;BR /&gt;---------------------------------&lt;BR /&gt;&lt;BR /&gt;select 'alter table ' || table_name from srb_flash&lt;BR /&gt;where table_name is not null;&lt;BR /&gt;  2&lt;BR /&gt;'ALTERTABLE'||TABLE_NAME&lt;BR /&gt;--------------------------------------------------------------------------------&lt;BR /&gt;alter table CUSTOMER&lt;BR /&gt;alter table DEPT&lt;BR /&gt;alter table EMPLOYEE&lt;BR /&gt;alter table NEWTBL&lt;BR /&gt;alter table SRB_FLASH&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Mar 2005 20:03:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889374#M845808</guid>
      <dc:creator>Stephen Badgett</dc:creator>
      <dc:date>2005-03-03T20:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889375#M845809</link>
      <description>Hi Steve,&lt;BR /&gt;&lt;BR /&gt;Yes creating a script with the alter table statements will be an easy solution. Here is how you do it.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; set heading off&lt;BR /&gt;SQL&amp;gt; select 'Alter table  '||table_name|| '  add (name varchar2(100), address varchar2(100), phone number);' &lt;BR /&gt;   from all_tables&lt;BR /&gt; where owner =  'SRB';&lt;BR /&gt;&lt;BR /&gt;This statement will prepare alter table statements for all the tables in the schema SRB  and the output will look like this :-&lt;BR /&gt;&lt;BR /&gt;Alter table TABLE_A add (name varchar2(100), address varchar2(100), phone number);&lt;BR /&gt;Alter table TABLE_B add (name varchar2(100), address varchar2(100), phone number);&lt;BR /&gt;Alter table TABLE_B add (name varchar2(100), address varchar2(100), phone number);&lt;BR /&gt;&lt;BR /&gt;Befor you execute the above SQL statement spool to a alter_tab.sql file. Like this&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; set heading off&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;spool alter_tab.sql&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select 'Alter table  '||table_name|| '  add (name varchar2(100), address varchar2(100), phone number);' &lt;BR /&gt;   from all_tables&lt;BR /&gt; where owner =  'SRB';&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; spool off&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;set heading on&lt;BR /&gt;&lt;BR /&gt;Now you will find the sql file alter_tab.sql created in your directory. Now to execute the created alter_tab.sql do this.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;spool alter_tab_output.log&lt;BR /&gt;SQL&amp;gt;@alter_tab.sql&lt;BR /&gt;SQL&amp;gt;spool off&lt;BR /&gt;&lt;BR /&gt;Now check the alter_tab_output.log file for any errors.&lt;BR /&gt;&lt;BR /&gt;Indira A</description>
      <pubDate>Thu, 03 Mar 2005 20:07:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889375#M845809</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2005-03-03T20:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889376#M845810</link>
      <description>Perfect -- thank you lots&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Mar 2005 20:18:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889376#M845810</guid>
      <dc:creator>Stephen Badgett</dc:creator>
      <dc:date>2005-03-03T20:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: adding columns to many tables - ORACLE</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889377#M845811</link>
      <description>You were all help in this and I do find this to be a great solution.  Thank you for the answer&lt;BR /&gt;&lt;BR /&gt;Stephen</description>
      <pubDate>Thu, 03 Mar 2005 20:20:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-columns-to-many-tables-oracle/m-p/4889377#M845811</guid>
      <dc:creator>Stephen Badgett</dc:creator>
      <dc:date>2005-03-03T20:20:03Z</dc:date>
    </item>
  </channel>
</rss>

