DROP SHARE
Description
The DROP SHARE statement is used to delete an existing SHARE object. After deletion, all consumer instances will immediately lose access to data through that SHARE, and the operation is irreversible.
Syntax
Parameter Description
| Parameter | Required | Description |
|---|---|---|
share_name | Yes | The name of the SHARE to delete |
IF EXISTS | No | If the SHARE does not exist, skip without raising an error |
Usage Examples
Example 1: Drop a SHARE
Example 2: Use IF EXISTS to avoid errors
Example 3: Check consumers before dropping
Before dropping, it is recommended to first check the consumer instances of the SHARE to understand the impact:
Example return (the to_instance column shows configured consumers):
Execute the drop after confirming there are no active consumers:
Notes
- After dropping a SHARE, all configured consumer instances will immediately lose access, which may cause errors in consumer queries or tasks.
- Dropping a SHARE does not delete the tables or views included in the SHARE; it only removes the sharing relationship.
- The operation is irreversible. To restore sharing, you must recreate the SHARE and reconfigure permissions and consumer instances.
- It is recommended to notify relevant consumers before dropping to avoid business disruptions.
Permission Requirements
The user executing DROP SHARE must have the DROP privilege or OWNERSHIP on the corresponding SHARE.
Related Statements
- CREATE SHARE: Create a SHARE object
- ALTER SHARE: Modify the target instances of a SHARE
- SHOW SHARES: Query the list of existing SHAREs
