ALTER SEMANTIC VIEW
ALTER SEMANTIC VIEW is used to rename an existing semantic view. Currently only renaming is supported. To modify the definition, use CREATE OR REPLACE SEMANTIC VIEW.
All semantic view DDL statements require the optimizer hint /*+ enable_semantic=true */ at the beginning of the statement. Without this hint, the system cannot recognize semantic view syntax.
Syntax
/*+ enable_semantic=true */
ALTER SEMANTIC VIEW [ IF EXISTS ] [view_schema.]view_name RENAME TO [view_schema.]new_name
Parameters
|
Parameter |
Required |
Description |
|
IF EXISTS |
No |
Suppresses the error when the specified semantic view does not exist. A warning is produced instead. If not specified, an error is returned when the target view does not exist. |
|
view_schema |
No |
The database that contains the semantic view. If omitted, the current database is used. |
|
view_name |
Yes |
The current name of the semantic view you want to rename. |
|
new_name |
Yes |
The new name for the semantic view. The name must be unique within the target schema and cannot conflict with any existing semantic view, table, or view. |
Usage notes
-
Currently only RENAME TO is supported. You cannot modify the definition content. To update the definition, use CREATE OR REPLACE SEMANTIC VIEW to recreate it.
-
Renaming synchronously updates the associated vector index. If the Embedding service is unavailable, the operation may fail. You can safely retry because the DDL is atomic and idempotent, with no impact on data consistency.
-
Renaming does not affect the semantic view's definition content or permission configurations.
Examples
-
Rename a semantic view in the current database.
/*+ enable_semantic=true */ ALTER SEMANTIC VIEW sales_analysis RENAME TO sales_overview; -
Rename a semantic view in a specified database.
/*+ enable_semantic=true */ ALTER SEMANTIC VIEW analytics.sales_analysis RENAME TO analytics.sales_overview; -
Use IF EXISTS to safely rename. No error is reported when the view does not exist.
/*+ enable_semantic=true */ ALTER SEMANTIC VIEW IF EXISTS old_view RENAME TO new_view;