Setting application context attributes
In this recipe, you'll create the PL/SQL package (for example, sh_ctx_pkg
) that will set application context attributes for the application context you created in the previous recipe (for example, sh_client
). Also, you'll create a logon trigger.
Getting ready
To complete this recipe, you'll need an existing user who can create sh_ctx_pkg
. Make sure that the user has direct privileges on the sh.customers
table (even if he/she has a DBA role) so that you don't receive this message in SQL*Plus: Warning: Package Body created with compilation errors.
or error Table or view doesn't exist in SQL Developer
(for more information, see Chapter 3, PL/SQL Security
).
How to do it...
- Connect to the database as a user who has appropriate privileges (for example, user
maja
):$ sqlplus maja
- Create the PL/SQL package that will set the
cust_id
attribute with the value, which is equal to the value of thecust_id
column when the following...