#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0

    dumping data from one table to another table


    HI,

    I am using oracle as my database. Here i need to dump data from one user table to another user table.

    ie..,
    User : User1
    Table name : table1


    I need to dump the contents of table1 of user1 to table1 of User2.

    Here one thing is i need to insert only those rows which are not present in table1 of user2 but present in table1 of user1.

    I think this not dumping..but inserting only selected rows..

    Is there any way to do this. if so please suggest me solution.


    Karthee
  2. #2
  3. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Canada
    Posts
    308
    Rep Power
    12
    I assume that:
    (1) Both users 'User1' and 'User2' are in the same databse.
    (2) You are connected to 'User1' and try to insert all rows from Table1 of 'User2' those are not in Table1 of 'User1'.
    (3) 'User1' has appropriate privileges to access Table1 in 'User2'
    (4) Structure of Table1 is identical in both users.

    Write the following query (it is an example only):

    INSERT into Table1
    (SELECT * FROM User2.Table1
    MINUS
    SELECT * FROM Table1)
    /

    To access the objects of remote database you need DATABASE LINK.

    Message: Make your life easy, Make others life easier.

    Regards

    Comments on this post

    • bokomoko agrees
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0
    Thanx Group,

    I have another question on this...

    I have a join table AB of 2 different tables Table A and Table B I have to dump this table AB from another user Table AB. Here also only those values i have to dump which is not present in the previous table. Does the above query sufficient to this ?

    Please help me out...
  6. #4
  7. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Canada
    Posts
    308
    Rep Power
    12
    Yes, it is.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0
    Thanx... may i know one thing what is the difference between NOT IN and MINUS...though we can use both..

IMN logo majestic logo threadwatch logo seochat tools logo