2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【PL/SQL】テーブルをまるごとコピー(CREATE TABLE SELECT)

Posted at

#テーブルをまるごとコピー(CREATE TABLE SELECT)
##やりたいこと
テーブル定義やデータのバックアップのためにコピーを行う。

##サンプルコード
copyコマンドなどはなく、CREATE TABLEを使用します。
NOLOGGING PARALLELとつけると高速化すると思ってください。

-- テーブル定義、データを含めコピー
CREATE TABLE table_copy NOLOGGING PARALLEL
 AS SELECT * FROM table_original;

##活用例
下記URLの差分確認などを使用し、同じテーブルで処理前後の差分比較などに使用します。
【PL/SQL】SELECT結果の差分確認(MINUS)
レコード数が多い場合など、比較確認が難しい場合に便利です。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?