Results 1 to 7 of 7

Thread: Copy Table

  1. #1
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Copy Table

    Employeedetails in user1,employeedetails in user2 both having same structure i want to replace content of user1.employeedetails with user2.emplooyeedetails how it is possible. Is there any copy command in oracle.
    if it is there, how it is used ??.....


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Copy Table

    1. truncate the user1 table.
    2. insert into user1 select * from user2;


  3. #3
    Junior Member
    Join Date
    Jul 2007
    Answers
    6

    Re: Copy Table

    first the insert query should be used then the truncate one,,, otherwise table data will not get copied


  4. #4
    Junior Member
    Join Date
    Aug 2007
    Answers
    1

    Re: Copy Table

    drop table in user2
    then use

    create table user2.employeedetails as select * from user1.employeedetails where 1=1


  5. #5
    Junior Member
    Join Date
    Feb 2007
    Answers
    17

    Re: Copy Table

    No it wont work cause 2 different users even if same database, it wont work.
    For this user2 should give select privilege to user1 on this table.
    So above suggesion may work plaese try out this


  6. #6
    Contributing Member
    Join Date
    Apr 2006
    Answers
    46

    Re: Copy Table

    do u mean somthing like --

    copy from user1@database1 to user2@database2 insert tab2 using select * from tab1
    ?


  7. #7
    Junior Member
    Join Date
    Feb 2007
    Answers
    17

    Re: Copy Table

    NO same database with different user.
    i.e
    copy from user1@database1 to user2@database1
    n if table name is tab1 in user1@database1 user/schema then queries will

    grant select on tab1 to user2@database1 ;--in user1@database1 schema

    insert into tab1 select * from user1.tab1; -- in user2@database1 schema
    or
    create table tab1 as select * from user1.tab1 ; -- in user2@database1 schema

    hope u got !


  8.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact