Returns the value of the attribute in a specified context. get_appcontext is a built-in function provided by the Application Context Facility (ACF).
get_appcontext (“context_name”, “attribute_name”)
is a row specifying an application context name. It is saved as datatype char(30).
is a row specifying an application context attribute name. It is saved as datatype char(30).
Shows VALUE1 returned for ATTR1.
select get_appcontext("CONTEXT1", "ATTRI1")
-------------- VALUE1
ATTR1 does not exist in CONTEXT2:
select get_appcontext("CONTEXT2", "ATTR1")
Shows the result when a user without appropriate permissions attempts to get the application context.
select get_appcontext("CONTEXT1", "ATTR2", "VALUE1")
Select permission denied on built-in get_appcontext, database dbid ----------- -1
This function returns 0 for success and -1 for failure.
If the attribute you require does not exist in the application context, get_appcontext returns “null.”
get_appcontext saves attributes as char datatypes. If you are creating an access rule that compares the attribute value to other datatypes, the rule should convert the char data to the appropriate datatype.
All arguments for this function are required.
ANSI SQL – Compliance level: Transact-SQL extension.
Permissions depend on the user profile and the application profile, and are stored by ACF.
For more information on the Application Context Facility see “Row-level access control” in Chapter 11, “Managing User Permissions” of the System Administration Guide.
Functions get_appcontext, list_appcontext, rm_appcontext, set_appcontext