| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: DBMS_SESSION.set_context
That couldn't possibly be the output of the procedure you included. The 'datamanID:' line appears above the 'Attribute is set now:' line in the code. The 'datamanagerID:' line appears below that. The only way thatthe 'datamanID:' line could appear without a value would be if the ID value from the xxx_datamanager table was null for the row being selected. In that case, the 'datamangerID:' line should appear with no value as well.
Richard
Eva Haiden wrote:
>
> Richard,
> Thank you for trying out my code. Did you use the my showContext
> procedure to show the values of the context? Because it does not print
> any values. Also, when I use the setDatamanagerID procedure, the
> context value is not printed. It just prints:
>
> Attribute is set now:
> datamanID:
>
> and no value. Do I miss any settings?
>
> Please help! Thank you!
> Eva
>
> Richard Kuhler <noone_at_nowhere.com> wrote in message news:<%OOg8.6146$Gu6.3125743_at_typhoon.san.rr.com>...
> > Obviously, you can't do the set_context as an 'exec' that would defeat
> > the purpose of a context. Only the dmContextPack should be able to do
> > that. I compiled this code on an 8.1.7 database and it ran without any
> > problems. The context was set properly. Are you sure that you don't
> > get an error that's being trapped by that 'when others' clause?
> >
> > Richard
> >
> > Eva Haiden wrote:
> > >
> > > Dear oracle users,
> > >
> > > I try to create an application context to be used with an security
> > > policy. The select in the below database package works, but the
> > > context does not get set. Any idea why this could be?
> > >
> > > Also, when I run
> > > exec dbms_session.set_context('carambaContext', 'datamangerID', 2) by
> > > itself, I get the following error message:
> > >
> > > *
> > > FEHLER in Zeile 1:
> > > ORA-01031: Unzureichende Berechtigungen
> > > ORA-06512: in "SYS.DBMS_SESSION", Zeile 78
> > > ORA-06512: in Zeile 1
> > >
> > > The context creation is as following:
> > >
> > > CREATE CONTEXT xxxContext USING xxx.dmContextPack;
> > >
> > > CREATE OR REPLACE PACKAGE dmContextPack as
> > >
> > > PROCEDURE setDatamanagerID;
> > > PROCEDURE showContext (context_name VARCHAR2, context_attribute
> > > VARCHAR2);
> > >
> > > END dmContextPack;
> > >
> > > CREATE OR REPLACE PACKAGE BODY dmContextPack IS
> > >
> > > PROCEDURE setDatamanagerID IS
> > >
> > > datamanID NUMBER;
> > >
> > > BEGIN
> > >
> > > select id
> > > into datamanID
> > > from xxx_datamanager
> > > where upper(dm_user) = SYS_CONTEXT('USERENV', 'session_user');
> > >
> > > dbms_session.set_context('xxxContext', 'datamangerID',
> > > datamanID);
> > > DBMS_OUTPUT.PUT_LINE ('datamanID: ' || datamanID);
> > > DBMS_OUTPUT.PUT_LINE ('Attribute is set now:');
> > > DBMS_OUTPUT.PUT_LINE ('datamanagerID: ' ||
> > > SYS_CONTEXT('xxxContext',
> > > 'datamanagerID'));
> > >
> > > EXCEPTION
> > > WHEN NO_DATA_FOUND
> > > THEN
> > > DBMS_OUTPUT.PUT_LINE ('No data found');
> > > WHEN OTHERS THEN
> > > DBMS_OUTPUT.PUT_LINE ('When others clause reached:');
> > > DBMS_OUTPUT.PUT_LINE ('datamanID: ' || datamanID);
> > >
> > >
> > > END setDatamanagerID;
> > >
> > >
> > >
> > > PROCEDURE showContext (context_name VARCHAR2, context_attribute
> > > VARCHAR2) IS
> > > BEGIN
> > >
> > > DBMS_OUTPUT.PUT_LINE (context_name || ' = ' ||
> > > SYS_CONTEXT(context_name,
> > > context_attribute));
> > >
> > > END showContext;
> > >
> > > END dmContextPack;
Received on Wed Mar 06 2002 - 11:54:51 CST
![]() |
![]() |