Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: DBMS_SESSION.set_context

Re: DBMS_SESSION.set_context

From: Richard Kuhler <noone_at_nowhere.com>
Date: Fri, 08 Mar 2002 00:14:58 GMT
Message-ID: <6oTh8.11731$Gu6.5281039@typhoon.san.rr.com>


Please clarify something for me. Are you saying that the 'datamanID:' line has a value on it but the 'datamanagerID:' line does not? Also, what is the exact call you are making when you get ORA-01031? I don't see any reason that you should get that from calling sys_context unless the standard package is screwed up.

Richard

Eva Haiden wrote:
>
> Hello,
>
> You are right, the context does get set. I just printed the context
> with the DBMS_SESSION.LIST_CONTEXT function and it printed the value
> of my context. But, I don't understand why the sys_context funtion
> will not print it. Also, the sys_context functiong gives me the Oracle
> error message: ORA-01031. Unfortunately, I can't make any sense out of
> it? Do you have any suggestions?
>
> Thank you,
> Eva
>
> Richard Kuhler <noone_at_nowhere.com> wrote in message news:<
> LJsh8.8209$Gu6.4435281_at_typhoon.san.rr.com>...
> > 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 that
> > the '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 Thu Mar 07 2002 - 18:14:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US