SQL Developer customization

One of the most common complaints about SQLDeveloper is that, unlike SQLPlus, which lets us run a glogin.sql and login.sql script to customize, SQLDeveloper doesn’t provide such a mechanism.
To customize, we could use database logon trigger as the following, be sure to grant select any dictionary privilege to the owner of the procedure db_trigger_proc.

create or replace procedure db_trigger_proc
is
  p_row v$session%rowtype;
begin
  select * into p_row
  from v$session
  where sid=(select sid from v$mystat where rownum=1);

  case
  when p_row.module = 'SQL Developer' then
  execute immediate 'alter session set nls_date_format='
  ||chr(39)||'YYYY-MM-DD HH24:MI:SS'||chr(39);
  -- add customization for other programs if needed.
  else null;
  end case;

  exception when NO_DATA_FOUND then null;
end;

create or replace trigger db_trigger
after logon on database
begin
db_trigger_proc;
end;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: