Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save libotti/98ee5a0250cae7e7da689e45ad92b6f7 to your computer and use it in GitHub Desktop.
Save libotti/98ee5a0250cae7e7da689e45ad92b6f7 to your computer and use it in GitHub Desktop.
How to set Oracle NLS_SESSION_SETTINGS WITH A TRIGGER
CREATE OR REPLACE TRIGGER sys.schema_nls_session_settings AFTER LOGON ON BOB.SCHEMA
BEGIN
execute immediate 'alter session SET NLS_TERRITORY="BRAZIL"';
execute immediate 'alter session SET NLS_LANGUAGE="BRAZILIAN PORTUGUESE"';
execute immediate 'alter session SET NLS_ISO_CURRENCY="BRAZIL"';
execute immediate 'alter session SET NLS_CURRENCY="R$"';
execute immediate 'alter session SET NLS_DATE_FORMAT="DD/MM/RR"';
execute immediate 'alter session SET NLS_DATE_LANGUAGE="BRAZILIAN PORTUGUESE"';
execute immediate 'alter session SET NLS_SORT="BINARY"';
execute immediate 'alter session SET NLS_TIME_FORMAT="HH24:MI:SSXFF"';
execute immediate 'alter session SET NLS_TIMESTAMP_FORMAT="DD/MM/RR HH24:MI:SSXFF"';
execute immediate 'alter session SET NLS_TIME_TZ_FORMAT="HH24:MI:SSXFF TZR"';
execute immediate 'alter session SET NLS_TIMESTAMP_TZ_FORMAT="DD/MM/RR HH24:MI:SSXFF TZR"';
execute immediate 'alter session SET NLS_DUAL_CURRENCY="Cr$"';
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment