• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

new table creation with data from different tables

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am using oracle 9i as my database.

I am in need to create a new table(Bill) by copying some of required columns in older 'table A'. this was done and all the existing data was copied from "tableA" to "bill" table.

how ever now anorther column from "tableB" needs to be copied in to my "Bill" table.

i tried to with alter command but was not useful.

kindly let me how to copy all the data of certain column in table to the new table.
 
Ranch Hand
Posts: 277
Oracle Spring Flex
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whats the relation between your Bill table and table2. Some more information, would help me understand better.
 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ashwin,

Thanks for reply.

"tableb" has these columns
org_id,
org_name,
org_ein,

"bill" table has below columns
org_id,
mem_id,
mem_name

all the org_id's in "tableb " are present in "bill"table. now i want to copy the org_name to bill table

Ashwin Sridhar wrote:Whats the relation between your Bill table and table2. Some more information, would help me understand better.

 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

i tried below query


select o.org_name
into bill from tableb o,bill b
where b.org_id = o.org_id


got error as "missing keyword"
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This does not seem to be ORM related so moving this to the JDBC forum for you.
 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what you want is an update with subselect statement.
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use the alter command to add the column, then an update to insert the data.
 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Wendy,

Wendy Gibbons wrote:what you want is an update with subselect statement.



thanks for reply the problem was solved. iused the alter command to add the new column and later on used the update query to copy all the needed data.
reply
    Bookmark Topic Watch Topic
  • New Topic