i漂泊

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 5144|回复: 0

如何在Oracle中复制表结构和表数据

[复制链接]
TA的礼物信息
  • 收到:0
  • 送出:2
发表于 2012-11-16 08:58:54 | 显示全部楼层 |阅读模式

1. 复制表结构及其数据:

  1. create table table_name_new as select * from table_name_old
复制代码

2. 只复制表结构:

  1. create table table_name_new as select * from table_name_old where 1=2;
复制代码

或者:

  1. create table table_name_new like table_name_old
复制代码

3. 只复制表数据:

如果两个表结构一样:

  1. insert into table_name_new select * from table_name_old
复制代码

如果两个表结构不一样:

  1. <p style="margin: 10px auto; ">insert into table_name_new(column1,column2...) select column1,column2... from table_name_old</p>pasting
复制代码


回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

QQ|小黑屋|手机版|IPiaoBo Inc. ( 渝ICP备17002826号 )

GMT+8, 2024-5-8 00:15 , Processed in 0.077698 second(s), 47 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表