<budget_name>!REMOVE_TAG¶
Removes a tag/value combination from a custom budget. The tag must be removed by reference.
Syntax¶
<budget_name>!REMOVE_TAG(
{ '<tag_reference>' | <reference_statement> },
'tag_value' )
Arguments¶
'tag_reference'
The serialized string representation that resolves to an tag. This string is the output of the SYSTEM$REFERENCE function.
reference_statement
A SYSTEM$REFERENCE statement that creates a reference for the tag to be removed from the budget.
'tag_value'
Specifies the value of the tag/value combination that you are removing from the budget.
If the tag was added to the budget with a different value, the tag continues to be associated with the budget after removing this specific tag/value combination.
Returns¶
Returns a VARCHAR value that indicates whether or not the tag/value combination was successfully removed from the budget.
If the tag could not be removed from the budget, the function returns an error message.
Access control requirements¶
The following minimum privileges and roles are required to call this method on a custom budget:
ADMIN instance role for the budget instance.
USAGE privilege on the database and schema that contains the budget instance.
USAGE privilege on the database and schema that contain the tag.
APPLYBUDGET privilege on the tag being removed.
For more information, see Budgets roles and privileges.
Usage notes¶
This method can only be called on custom budget instances.
Calling this method does not return the object. Because of this, you can’t use method chaining to call another method on the return value of this method. Instead, call each method in a separate SQL statement.
Examples¶
- Retrieve the tag reference before calling the method to remove the tag/value combination.
The following statement creates and returns a reference for the
cost_center
tag:SELECT SYSTEM$REFERENCE( 'TAG', 'cost_mgmt_db.tags.cost_center', 'SESSION', 'APPLYBUDGET');
The statement returns the reference in the output.
ENT_REF_TAG_10382726315710_8A8626AE765E29446C38A217CAD093FCC9A454C2
The following statement uses the string literal for this reference to add the
cost_center = 'sales'
tag/value combination to thebudget_db.budget_schema.my_budget
budget:CALL budget_db.budget_schema.my_budget!REMOVE_TAG( 'ENT_REF_TAG_10382726315710_8A8626AE765E29446C38A217CAD093FCC9A454C2', 'sales');
- Include the SYSTEM$REFERENCE function in the argument directly
After executing the following statement, the budget will no longer track objects that are tagged with the tag/value combination
team_tag = 'finance'
.CALL budget_db.budget_schema.my_budget!REMOVE_TAG( (SELECT SYSTEM$REFERENCE('TAG', 'cost_mgmt_db.tags.team_tag', 'SESSION', 'APPLYBUDGET')), 'finance');