Purpose
Use this statement to rename schemas and schema objects.
Prerequisites
- If the object is a schema, you need the system privilege USE ANY SCHEMAor the object privilegeUSAGEon 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 USERorCREATE ROLEprivileges.
- 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
 
- You have the system privilege 
Syntax
rename::=
                                                                         
                                                                    
Usage notes
-  RENAMEcannot be used to move a schema object to another schema. For example,RENAME TABLE s1.t1 TO s2.t2is not allowed.
- Distinguishing between schema and table is optional and only necessary if two identical objects share the same name.
- 
                                                                    In the system tables EXA_USER_VIEWS, EXA_ALL_VIEWS, and EXA_DBA_VIEWS, renaming a view only changes the VIEW_NAMEand does not alter theVIEW_TEXT. This means that ifVIEW_TEXTis used to recreate a view, the old/original name will be used.
- 
                                                                    In the system tables EXA_USER_FUNCTIONS, EXA_ALL_FUNCTIONS, and EXA_DBA_FUNCTIONS, renaming a function only changes the FUNCTION_NAMEand does not alter theFUNCTION_TEXT. This means that ifFUNCTION_TEXTis used to recreate a function, the old/original name will be used.
Examples
RENAME SCHEMA s1 TO s2;
RENAME TABLE t1 TO t2;
RENAME s2.t3 TO t4;