Home » SQL & PL/SQL » SQL & PL/SQL » copy another user tables
copy another user tables [message #290804] Mon, 31 December 2007 21:34 Go to next message
susuOra
Messages: 10
Registered: December 2007
Location: USA
Junior Member
Hey,
I'm sorry but I'm really new to oracle.

If a user wants to copy another user tables with its rows, how would I do that as part of the create table statement?
How would I do it with one insert statement?

Thanks,
Re: copy another user tables [message #290805 is a reply to message #290804] Mon, 31 December 2007 21:52 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
CREATE TABLE MY_TABLE AS SELECT * FROM OTHER_USER.MY_TABLE;
Re: copy another user tables [message #290806 is a reply to message #290804] Mon, 31 December 2007 21:59 Go to previous messageGo to next message
susuOra
Messages: 10
Registered: December 2007
Location: USA
Junior Member
Thanks for replaying me.
I think this would create the table with same columns but not with its contents.
Am I right?
Re: copy another user tables [message #290808 is a reply to message #290804] Mon, 31 December 2007 22:25 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
>Am I right?
Are you unwilling or incapable of executing the SQL and answering the question YOURSELF?
Re: copy another user tables [message #290809 is a reply to message #290808] Mon, 31 December 2007 22:55 Go to previous messageGo to next message
susuOra
Messages: 10
Registered: December 2007
Location: USA
Junior Member
I'm sorry I just don't have an access to oracle right now to try it.
Also, I tried that before a week and it didn't load the data.
Do I need a particular privilege for that.


[Updated on: Mon, 31 December 2007 22:58]

Report message to a moderator

Re: copy another user tables [message #290810 is a reply to message #290804] Mon, 31 December 2007 23:03 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
Oracle is NOT learned by trial & error.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/toc.htm
When all else fails, RTFM & all can be found at http://tahiti.oracle.com
Re: copy another user tables [message #290814 is a reply to message #290809] Tue, 01 January 2008 00:50 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can create an account and use a database at http://apex.oracle.com/pls/otn/f?p=4550:1:1734052917527448:::::

And to answer your question:
- "select * from table" get the whole content
- "create table" creates the table
- so combining both you get?

Regards
Michel
Previous Topic: ANYDATA
Next Topic: Duplicate rows (3 topics merged)
Goto Forum:
  


Current Time: Sun Dec 04 12:37:15 CST 2016

Total time taken to generate the page: 0.07978 seconds