Home » SQL & PL/SQL » SQL & PL/SQL » DBMS_session.set_context
DBMS_session.set_context [message #226349] Fri, 23 March 2007 05:54 Go to next message
kukreja
Messages: 33
Registered: February 2007
Member
when i am running this procedure DBMS_session.set_context in my session it says insufficient privelege though i have given permissions on dbms_session package to my user
Re: DBMS_session.set_context [message #226363 is a reply to message #226349] Fri, 23 March 2007 06:32 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

You probably do it like this

Sorry for the swedish Wink

dwadm@DW.US.ORACLE.COM> begin
  2  DBMS_SESSION.SET_CONTEXT ('color', 'red', 'nice');
  3  end;
  4  /
begin
*
Fel på rad 1:
ORA-01031: otillräcklig behörighet
ORA-06512: vid "SYS.DBMS_SESSION", rad 78
ORA-06512: vid rad 2


You have to call inside a package -> Which you referred to when you did create contex

Something like this
dwadm@DW.US.ORACLE.COM> CREATE CONTEXT my_ctx USING my_pkg;

Kontext har skapats.

dwadm@DW.US.ORACLE.COM> CREATE OR REPLACE PACKAGE my_pkg
  2  IS
  3     PROCEDURE test_ctx;
  4  END;
  5  /

Paket är skapat.

dwadm@DW.US.ORACLE.COM> CREATE OR REPLACE PACKAGE BODY my_pkg
  2  IS
  3     
  4        
  5     PROCEDURE test_ctx IS 
  6     BEGIN   
  7        DBMS_SESSION.SET_CONTEXT ( 'color', 'blue','ugly');
  8        DBMS_SESSION.SET_CONTEXT ( 'color', 'red','nice');
  9     END;
 10  END;
 11  /
 Paketstomme är skapad.


Hope that helps
Re: DBMS_session.set_context [message #226367 is a reply to message #226349] Fri, 23 March 2007 06:46 Go to previous messageGo to next message
kukreja
Messages: 33
Registered: February 2007
Member
I am calling this in package only but when i am saying exec package_name.procedure it is saying me insufficient privilege.
Package is the one used to create context
Re: DBMS_session.set_context [message #226369 is a reply to message #226367] Fri, 23 March 2007 06:54 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Would be easier, if you do what i did.

Provide an code example....
Re: DBMS_session.set_context [message #227614 is a reply to message #226369] Wed, 28 March 2007 15:40 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
For secutity, you need to specify which pkg/proc can set the context values (like in your example)...
CREATE CONTEXT my_ctx USING my_pkg;


Re: DBMS_session.set_context [message #228079 is a reply to message #227614] Sat, 31 March 2007 05:43 Go to previous messageGo to next message
andy_ora123
Messages: 7
Registered: March 2007
Junior Member
because of security reasons

we need to specify the package or proc that will be using the variables
Re: DBMS_session.set_context [message #228083 is a reply to message #228079] Sat, 31 March 2007 05:55 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
echo...
Previous Topic: Selecting from a varray (Merged)
Next Topic: Are not all the system related users created on the creation of the database?
Goto Forum:
  


Current Time: Wed Dec 07 22:11:00 CST 2016

Total time taken to generate the page: 0.12725 seconds