#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0

    Copy table data to other table


    Hello, is there any short query that allows copy table data to other table? Even when for example table1 has different schema then table2, so i dont have need to use this - INSERT INTO table1 all columns SELECT all columns + new values or columnts that arent in table2 but are in tabl1 FROM table2 etc. Like i have in table1 like about 20 columns but in table2 there are only 14.
    i have 4 history tables and those same 4 history hqt tables, like HST_SRV_CASES and HST_SRV_CASES_HQT. In HST_SRV_CASES there are more columns than in HST_SRV_CASES_HQT, because HST_SRV_CASES_HQT isnt used in long time and i need copy data from that table to usual history table which is being used right now and then delete all data from hqt table when finished copying all.

    So is there any short query to do this?

    Thank you for answers
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    857
    Rep Power
    388

    Cool


    Originally Posted by xWarriors
    Hello, is there any short query that allows copy table data to other table? . . .
    . . .
    So is there any short query to do this?

    Thank you for answers
    NO, there is not,
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    857
    Rep Power
    388

    Talking


    Originally Posted by LKBrwn_DBA
    NO, there is not,
    Well, perhaps there is a chance:
    1) Dump the source table to a delimited file.
    2) Create an sql loader control file to map that dump file to the target table
    3) Execute sql loader with "append" option to load the data.
  6. #4
  7. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Canada
    Posts
    308
    Rep Power
    12
    You can use schema name just before the table name to copty data from one table to another.

    For example you want to copy data from table_main which is in the HR schema to table_temporary which is in DEV schema. First connect to DEV schema and try the following code:

    Code:
     INSERT INTO table_temporary (SELECT * FROM hr.table_main);
    Another thing< I just remember you can copy data even from different oracle database on different computer also as long as you have access to that computer and it is also oracle database; to do so, use database link. fo to oracle website to find more detail.

IMN logo majestic logo threadwatch logo seochat tools logo