RENAME

Purpose

Use this statement to rename schemas and schema objects.

Prerequisites

  • If the object is a schema, it must belong to the user or one of the user roles.
  • If the object is a schema object, the object must belong to the user or one of the user roles (that is, located in one's own schema or that of an assigned user role).
  • If the object is a user or role, then the user requires the CREATE USER or CREATE ROLE privileges.
  • If the object is a connection, the user requires the ALTER ANY CONNECTION system privilege, or the user has received the connection the WITH ADMIN OPTION.
  • If the object is a consumer group, the user needs to have the system privilege MANAGE CONSUMER GROUPS.

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;