RENAME

Purpose

Use this statement to rename schemas and schema objects.

Prerequisites

  • If the object is a schema, you need the system privilege USE ANY SCHEMA or the object privilege USAGE on the schema, or the schema must be owned by you or one of your assigned roles.
  • If the object is a schema object, the object must be located in a schema that is owned by you or one of your assigned roles.
  • If the object is a user or role, you need the CREATE USER or CREATE ROLE privileges.
  • If the object is a consumer group, you need the system privilege MANAGE CONSUMER GROUPS.
  • If the object is a connection, at least one of the following prerequisites must be fulfilled:
    • You have the system privilege ALTER ANY CONNECTION
    • The connection is granted to you with the WITH ADMIN OPTION
    • The connection belongs to you or one of your assigned roles

Syntax

rename::=

Rename Object Statement

Usage Notes

  • Schema objects cannot be shifted to another schema with the RENAME statement. For example, 'RENAME TABLE s1.t1 TO s2.t2' is not allowed.
  • Distinguishing between schema or tables is optional and only necessary if two identical objects share the same name.

Examples

RENAME SCHEMA s1 TO s2;
RENAME TABLE t1 TO t2;
RENAME s2.t3 TO t4;