| Oracle8i SQL Reference Release 3 (8.1.7) Part Number A85397-01 |
|
SQL Statements:
CREATE CLUSTER to CREATE SEQUENCE, 3 of 25
Use the CREATE CONTEXT statement 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. You can use the DBMS_SESSION.set_context procedure in your designated package to set or reset the attributes of the context.
|
See Also:
|
To create a context namespace, you must have CREATE ANY CONTEXT system privilege.
OR REPLACE
Specify OR REPLACE to redefine an existing context namespace using a different package.
namespace
Specify the name of the context namespace to create or modify. Context namespaces are always stored in the schema SYS.
schema
Specify the schema owning package. If you omit schema, Oracle uses the current schema.
package
Specify the PL/SQL package that sets or resets the context attributes under the namespace for a user session.
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 © 1996-2000, Oracle Corporation. All Rights Reserved. |
|