Error in set date oracle - oracle

My oracle have:
NLS_DATE_FORMAT DD/MM/RR
NLS_DATE_LANGUAGE SPANISH
and i execute
alter session set nls_date_format = 'DD-MON-RR';
alter session set NLS_DATE_LANGUAGE = 'AMERICAN';
alter system set nls_date_format='DD-MON-RR'
And everything is correct, but when i reset sql developer change to
LS_DATE_FORMAT=DD/MM/RR other one
How can I change it forever?

Your session settings might have been overwritten by SQL Developer when it relaunches.
To permanently fix it, Open SQL Developer and go to Tools -> Preference -> Database -> NLS and change Date Format to your required format there.

Alternatively, you could use an after logon trigger. That way you can set your settings independent of the client (SQL Developer) used.

Related

SQL Developer after restart resets NLS_LANGUAGE parameters

Could anyone advice please, what could be the cause of such problem:
After each restart of Oracle SQL developer NLS_LANGUAGE settings are being reset each time.
For example, when just opening a new session, NLS_LANGUAGE is set to LATVIAN and each time when starting SQL Dev, we need to run "alter session set NLS_LANGUAGE = 'AMERICAN'" to set it back to American.
Even that in Options -> NLS everywhere is set American.
We've checked all main lanaguage/location/region settings and set American everywhere, but still after re-launch only NLS_LANGUAGE setting is being reset, rest (like NLS_TERRITORY) are fine.
What hasn't been changed that triggers each time that reset?
You can change in Preferences. Search for NLS and change Language to AMERICAN

Thai language Configuration in Oracle

I have an issue regarding configuring Thai language in oracle (PL/SQL Developer). I have configured Thai language 'AMERICAN_AMERICA.TH8TISASCII' in regedit. Also I configured Environment variables in my computer. But still when I connect PL/SQL developer and retrieve data, columns that should show Thai descriptions are showing garbage data. Please help me.
Example of garbage data is '¿¿¿¿¿¿¿¿'
Oracle Configurations is as below :
regedit->computer->HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE->KEY_OraDB11g_home1
Windown Configuration is as below:
Mycomputer->Advanced system setting->Advanced System
Settings->Environment Variables -> (here i added variable)
the same configuration is done by my peers and they got the configuration but i am not able to do this
I have configured Thai language 'AMERICAN_AMERICA.TH8TISASCII' in regedit.
It means you have configured your NLS_LANGUAGE as AMERICAN and NLS_TERRITORY as AMERICA. Which is wrong.
You should select the following:
NLS_LANGAUGE=THAI
NLS_TERRITORY=THAILAND
You need to do this at:
Database level - init.ora file
Environment level - NLS LANG settings
I think your characterset is fine.
UPDATE OP got the issue with PL/SQL Developer tool.
You can enter "alter session" commands in the AfterConnect.sql file in the PL/SQL Developer installation directory. For example:
alter session set nls_date_format='dd-mm-yyyy';
alter session set nls_territory='THAILAND';
alter session set nls_language='THAI';
source
I assume your selected font in PL/SQL Developer does not support Thai characters. Try this command to check:
SELECT UNISTR('Kho Khuat: \0E03') FROM DUAL;
Do you get proper output like this?
Kho Khuat: ฃ
If not, you should select a font which support Thai characters.
You can use this page FileFormat.info to check which font supports your character.
Value for NLS_LANG should match your local environment settings, not the setting from Database. By this all characters are properly translated in SQL communication.
Check you local environment with this command:
c:\>reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP
In my case it is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
ACP REG_SZ 1252
So, my NLS_LANG should be set to .WE8MSWIN1252 or something similar.
However, this is only valid if your application (SQL Developer in your case) uses the default encoding settings from Windows. In some applications you can change that - typically you can switch between local codepage and Unicode (UTF-8). In this case you must modify NLS_LANG accordingly.

Altering session permanently

Is it possible to alter the session permanently even after i close my oracle sql developer?
An example of the statement that i want to alter:
Alter Session Set Nls_Timestamp_Tz_Format='HH24:MI TZR';
The above statement only allow me to alter the current session and not making it permanently.
Thanks
If you just want to change the default value for SQL Developer, you can do that in the SQL Developer settings. In SQL Developer 3.1 (the same settings exist in earlier versions though the navigation may be slightly different), Tools | Preferences | Database | NLS allows you to specify a Timestamp Format and a Timestamp TZ Format. SQL Developer will then automatically issue the appropriate ALTER SESSION commands for you whenever it creates a new session.
You need to set this in the initialization parameter file to affect the database globally.
Initialization parameters such as Nls_Timestamp_Tz_Format can be set up from three sources:
In a session using the ALTER SESSION SET statement
In client side parameter file init.ora
In server side parameter file spfile
To set default permanently in the db, from the database:-
alter system ... scope=spfile;
then as SYS (so you may need to talk to a DBA), and obviously at an appropriate time! -
shutdown;
startup;
(I know the spfile has been mentioned, but it can all be done from the sqlplus cmdline, at least in 11g.)

Changing Character set to Arabic In Oracle

Kindly guide me how to change the character set to Arabic in Oracle .
please mention the steps that i need to follow, regrading it.
go to start>run type regedit and then look for by pressing h key in keyboard hkey local machine and software and oracl dev home and look for nls_lang change it to AMERICAN_AMERICA.AR8MSWIN1256
Check this link for step by step instructions: http://download.oracle.com/docs/cd/B10501_01/server.920/a96529/ch10.htm#1009904
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE CHARACTER SET AR8ISO8859P6;
SHUTDOWN IMMEDIATE; -- or SHUTDOWN NORMAL;
STARTUP;

How to change default nls_date_format for oracle jdbc client

I have defined the global nls_date_format on Oracle 10.2 XE as follows:
alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
When connecting on Windows, the clients override it with session specific format, so I need to run this line at the beginning of every session:
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
However, I have some custom code that I can't change (jdbc code, using ojdbc14.jar), so I can't execute this line when receiving the connection. Is there a way to change the default value of nls_date_format for all jdbc connections? Perhaps adding something to the connection string, or some environment variable that I can use?
By the way, sqlplus and sqldeveloper also override the server's format with their own, but I found out how to change their defaults, so the problem is only with jdbc connections.
Set nls date format in an after logon trigger
Thanks, that worked for me.
The trigger that I inserted is this:
CREATE OR REPLACE TRIGGER LOGINTRG
AFTER LOGON ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT=''YYYY-MM-DD HH24:MI:SS''';
END LOGINTRG;

Resources