SWAP_PARTITIONS_BETWEEN_TABLES

Swaps partitions between two tables.

Syntax

SWAP_PARTITIONS_BETWEEN_TABLES (
    '[[database.]schema.]staging‑table',
    'min‑range‑value',
    'max‑range‑value', 
    '[[database.]schema.]target‑table'
     [, force‑split]
)

Parameters

[database.]schema

Specifies a schema, by default public. If schema is any schema other than public, you must supply the schema name. For example:

myschema.thisDbObject

If you specify a database, it must be the current database.

staging‑table

The staging table from which to swap partitions.

min‑range‑value
max‑range‑value
The minimum and maximum value of partition keys to swap, where min‑range‑value must be ≤ max‑range‑value. To swap one partition, min‑range‑value and max‑range‑value must be equal.
target‑table

The table to which the partitions are to be swapped. The target table cannot be the same as the staging table.

force‑split

Optional Boolean argument, specifies whether to split ROS containers if the range of partition keys spans multiple containers or part of a single container:

  • true: Split ROS containers as needed.
  • false (default): Return with an error if ROS containers must be split to implement this operation.

Privileges

One of the following:

Requirements

The following attributes of both tables must be identical:

Restrictions

The following restrictions apply to the source and target tables:

Examples

See Swapping Partitions.