Oracle8i SQL Reference Release 2 (8.1.6) A76989-01 |
|
SQL Statements (continued), 2 of 20
To create a namespace for a context (a set of application-defined attributes that validates and secures an application) and to associate the namespace with the externally created package that sets the context.
To create a context namespace, you must have CREATE
ANY
CONTEXT
system privilege.
|
redefines an existing context namespace using a different package. |
|
namespace |
is the name of the context namespace to create or modify. Context namespaces are always stored in the schema |
|
schema |
is the schema owning package. If you omit schema, Oracle uses the current schema. |
|
package |
is the PL/SQL package that sets or resets the context attributes under the namespace for a user session. See Also: Oracle8i Supplied PL/SQL Packages Reference for more information on setting the package. |
|
Note: To provide some design flexibility, Oracle does not verify the existence of the schema or the validity of the package at the time you create the context. |
Suppose you have a human resources (HR) application and a PL/SQL package (HR_SECURE_CONTEXT
), which validates and secures the HR application. The following statement creates the context namespace HR_CONTEXT
and associates it with the package HR_SECURE_CONTEXT
:
CREATE CONTEXT hr_context USING hr_secure_context;
You can control data access based on this context using the SYS_CONTEXT
function. For example, suppose your HR_SECURE_CONTEXT
package has defined an attribute ORG_ID
as a particular organization identifier. You can secure a base table HR_ORG_UNIT
by creating a view that restricts access based on the value of ORG_ID
, as follows:
CREATE VIEW hr_org_secure_view AS SELECT * FROM hr_org_unit WHERE organization_id = SYS_CONTEXT('hr_context', 'org_id');
|
![]() Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|