Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up default "alter session" for an Oracle user

For a JDBC application I need to issue a few ALTER SESSION commands. I do not want to put those into the application code itself. Is there a way to specify defaults for the session parameters for the database schema that the application uses (on the database side) ?

like image 953
Thilo Avatar asked Sep 14 '09 06:09

Thilo


1 Answers

most session parameters are defined by the client application. If you want to override the client settings you could create a DATABASE TRIGGER. For example, this will create a LOGON trigger on the BAR schema:

CREATE OR REPLACE TRIGGER bar.foo
   AFTER LOGON ON DATABASE WHEN (USER = 'BAR')
BEGIN
   dbms_session.set_nls('NLS_NUMERIC_CHARACTERS', '''.,''');
   EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA=hr';
END foo;
like image 88
Vincent Malgrat Avatar answered Sep 18 '22 15:09

Vincent Malgrat