Setting nls_date_format....in oracle 9i v 9.2
Setting nls_date_formate is working in session level fine.
But i need to set the format in an application level.For that i tried the following,but date format is not changed.
i created the Pfile from SPfile,made an entry nls_date_format='DD/MM/YYYY'. and then i created SPfile from Pfile.but date format is not changed.
Hi,
If the client environment sets any of the NLS_* parameters, they override the server in all cases. So if the client sets, for example, the NLS_LANG parameter, that will cause all NLS_* settings on the server to be ignored. The server will use the client's specified values and default values for all other NLS settings instead, ignoring anything in init.ora.
Where that typically comes into play is if the client is Windows. The client install on Windows sets the NLS_LANG parameter in the registry by default. The fact that the client sets the NLS_LANG parameter causes the NLS settings you put in the init.ora not to be used by that client. To solve this, you can
* Set the NLS_DATE_FORMAT in the registry on the client
* Put an ALTER SESSION SET nls_date_format=your_format statement in your application right after the connect
* Use an AFTER LOGON trigger similar to the one supplied below:
create or replace trigger
data_logon_trigger
after logon
on database
begin
execute immediate 'alter session set nls_date_format = ''your format here'' ';
end;
/Cheers
Similar Messages
-
Alter session set NLS_DATE_FORMAT and to_date not working
Hey folks,
for the sake of simplicity let's assume i want to get the current system time from the table dual in a certain format, e.g. 'YY.MM.DD'.
Currently the query
select sysdate from dual;
yields:
07-JAN-08
The desired output should look like this:
08.01.07
So, according to the manual, i tried the following:
alter session set NLS_DATE_FORMAT = 'yy.mm.dd';
No effect, date is still displayed as
07-JAN-08
Even the following query:
select TO_DATE (sysdate, 'yy.mm.dd') from dual;
yields
07-JAN-08
What am i doing wrong here?
Additional information:
-> DB is Oracle 9
-> I am using the Oracle SQL Developer under Ubuntu Gutsy
-> No, i did not forget to commit my commands....:-)
Any ideas?select TO_CHAR (sysdate, 'yy.mm.dd') from dual;However the alter session command should work:
SQL*Plus: Release 9.2.0.2.0 - Production on Mon Jan 7 14:32:26 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> alter session set NLS_DATE_FORMAT = 'yy.mm.dd';
Session altered.
SQL> select sysdate from dual;
SYSDATE
08.01.07
SQL> Note: There is nothing to commit here. Only selects, no DML.
Message was edited by:
Sven W. -
Logon trigger setting nls_date_format over ridden by sql developer?
Problem: Developers are inserting a Date record into a varchar field. I can't change this process right now. Non-Date info is stored here also. Would require a code change.
To simplify this, I wanted to get all the developers to insert using the same 'nls_date_format'. I had hoped to be able to centralize this by having Oracle set it in the database. I tried this by setting the database nls_date_format and with a logon trigger.
See test below. Seems to be over ridden.
Test case is with SQL Developer. Noticed the same thing when developers use Websphere. I think we reduce the chance for errors, if I can handle this in the database. However, my nls_date_format settings are getting over ridden.
1. s et database parameter nls_date_format to YYYY-MM-DD HH24:MI:SS , this gets over riden by SQL Developer/Websphere
2. Created a trigger with an 'alter session', but this seems to get over ridden also.
Please see test case below:
Oracle 11.2.0.3
test logging: SQLPLUS locally on the unix server, then log in using SQL Developer which is installed on my laptop.
SQL Developer NLS_DATE_FORMAT : YYYY-MON-DD HH24:MI:SS , This is different for test purposes
I have auditing turned turned on to db,extended with 'audit all by 'user' by access;' for test purposes to get more info.
create table test (username varchar2(30),sid number,mytest varchar2(300),insert_date date);
create or replace
TRIGGER LOGINTRG
AFTER LOGON ON DATABASE
BEGIN
insert into test select user, sys_context('USERENV','SID') ,value,sysdate from v$parameter where name = 'nls_date_format';
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT=''YYYY-MM-DD HH24:MI:SS''';
insert into test select user, sys_context('USERENV','SID') ,value,sysdate from v$parameter where name = 'nls_date_format';
commit;
END LOGINTRG;
/Results/Questions
1. When I select from 'test', I confirm that my NLS_DATE_FORMAT is the same both before and after the alter session.
2. select value from v$parameter where name = 'nls_date_format'
output: YYYY-MON-DD HH24:MI:SS (so sql developer is over riding this);
3. select * from dba_audit_trail where username = 'MYUSER' order by timestamp desc;
The SQLs from the logon trigger are not captured. how do I capture logon trigger sqls? Not a huge deal, just curious
4. I do not see any alter sessions issued by my user. shouldn't audit all by access capture that? how could my session nls_date_format change without an alter session?
Edited by: Guess2 on Apr 22, 2013 10:44 AM>
Problem: Developers are inserting a Date record into a varchar field.
>
No - they aren't. That is physically impossible. The only thing that can be stored in a 'varchar field' is a string. Oracle considers ANYTHING stored in a character column to be a string.
Date values are stored in DATE columns. Perhaps you meant that developers are converting DATE values to strings and then storing the string in a 'varchar field'?
>
I can't change this process right now. Non-Date info is stored here also.
>
WONDERFUL! Why use a column to stored just one type of data? That is extremely wasteful. Hopefully you store strings that represent numbers in that same column also? It makes the data model so much easier to understand if developers only need to learn one datatype.
>
Would require a code change.
>
The horror!
You should never, ever, EVER use a code change to fix a problem if there is even the slightest possibility that you can change the ENTIRE DATABASE instead.
I've got good news though. You are now on version Oracle 11.2.0.3 and Oracle, after months of protests by some of their largest clients, has finally dropped the exhorbitant license fees for using some of the more esoteric datatypes like DATE and NUMBER.
You should suggest to your manager that they use some of the license fee money saved to hire developers that already know how to design proper data models and use those new-fangled datatypes.
Trust me - once you've made it up that steep learning curve your code will have fewer of those pesky 'dirty data' issues to deal with.
Sure - it means less job security for your current developers. But sometimes you just have to 'take one for the team'! -
Setting Date in ORACLE Server.
Hi All,
How to set date for ORACLE server. I.e usually we set the date for system in the system properties or go to control panel and set it in DATE & Time section on a windows PC. But during various circumstatnces i am not given permission to do it and every time i need to do this. Is there a way to achieve this without touching the server date & time. So that when ever i use SYSDATE that will return the date which i have set.
Note - I have already gone through FIXED_DATE built in available in ORACLE.
Would like to know other possibilities for achieving my requirement.
Thanks in advance.Sanju P Ommen wrote:
Hi
Changing the init.ora >> NLS_DATE_FORMAT="DD-MM-YYYY" would do the needful.
Edited by: Sanju P Ommen on Feb 11, 2010 4:07 AMThat does NOT change the date. It only changes the default format by which date values are returned to users. -
Setting nls_date_format
Hi,
I'm trying to change the parameter nls_date_format in Oracle 9.2. I'm using OEM in standalone-mode, logged in as sysdba. The parameter is currently not set. When I try to change it to "DD.MM.YYYY" I get the error ORA-02096: specified initialisation parameter is not modifiable with this option.
Any ideas?
Thanks,
MikeHere's a list of the parameters from alert.log:
System parameters with non-default values:
processes = 150
timed_statistics = TRUE
shared_pool_size = 50331648
large_pool_size = 8388608
java_pool_size = 33554432
control_files = C:\Programme\OraHome92\oradata\hdb\CONTROL01.CTL, C:\Programme\OraHome92\oradata\hdb\CONTROL02.CTL, C:\Programme\OraHome92\oradata\hdb\CONTROL03.CTL
db_block_size = 8192
db_cache_size = 25165824
compatible = 9.2.0.0.0
db_file_multiblock_read_count= 16
fast_start_mttr_target = 0
undo_management = AUTO
undo_tablespace = UNDOTBS1
undo_retention = 10800
remote_login_passwordfile= EXCLUSIVE
db_domain = derrc0fnp001
instance_name = hdb
dispatchers = (PROTOCOL=TCP) (SERVICE=hdbXDB)
job_queue_processes = 10
hash_join_enabled = TRUE
background_dump_dest = C:\Programme\OraHome92\admin\hdb\bdump
user_dump_dest = C:\Programme\OraHome92\admin\hdb\udump
core_dump_dest = C:\Programme\OraHome92\admin\hdb\cdump
sort_area_size = 524288
db_name = hdb
open_cursors = 300
star_transformation_enabled= FALSE
query_rewrite_enabled = FALSE
pga_aggregate_target = 25165824
aq_tm_processes = 1 -
hi,
i programme a procedure which include some requirements that
should execute the command like ' alter session set
NLS_DATE_FORMAT='YYYYMMDD' '.
but the sqlplus error is
PLS-00103: Encountered the symbol "ALTER" when expecting one of
the following:
begin declare end exit for goto if loop mod null pragma
raise
return select update while <an identifier>
<a double-quoted delimited-identifier> <a bind
variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall
<a single-quoted SQL string>
The symbol "update was inserted before "ALTER" to
continue.
help me please.you can set that parameter in 2 ways from stored procedures.
1) execute immediate 'alter session...'
remember, Oracle gives commit while executing above command.
2) use dbms_session.set_nls procedure.
dbms_session.set_nls('nls_date_format','mm/dd/yyyy');
Suresh Vemulapalli -
A problem regarding set up of Oracle Lite 3.6.0.2.0 on Win 95, with JDK 1.1.8 and Java 2 SDK ( Ver 1.3 Beta)
After the installation of Oracle Lite 3.6.0.2.0 on a laptop (with WIN 95 OS), When I run Oracle Lite Designer from start menu, I receive following error message :
====================================
Invalid class name 'FILES\ORA95_2\LITE\DESIGNER\oldes.jar;C:\PROGRAM'
usage: java [-options] class
where options include:
-help print out this message
-version print out the build version
-v -verbose turn on verbose mode
-debug enable remote JAVA debugging
-noasyncgc don't allow asynchronous garbage collection
-verbosegc print a message when garbage collection occurs
-noclassgc disable class garbage collection
-ss<number> set the maximum native stack size for any thread
-oss<number> set the maximum Java stack size for any thread
-ms<number> set the initial Java heap size
-mx<number> set the maximum Java heap size
-classpath <directories separated by semicolons>
list directories in which to look for classes
-prof[:<file>] output profiling data to .\java.prof or .\<file>
-verify verify all classes when read in
-verifyremote verify classes read in over the network [default]
-noverify do not verify any class
-nojit disable JIT compiler
Please make sure that JDK 1.1.4 (or greater) is installed in your machine and CLASSPATH is set properly. JAVA.EXE must be in the PATH.
====================================
My ORACLE_HOME is c:\program files\ora95_2 and Oracle Lite is installed under the ORACLE_HOME in LITE\DESIGNER directory.
JDK version is 1.1.8 which is greater than 1.1.4 installed in c:\program files\jdk1.1.8, My PATH, and CLASSPATH are set in AUTOEXEC.BAT as follows:
set CLASSPATH=c:\Progra~1\jdk1.1.8\lib\classes.zip;c:\progra~1\ora95_2\lite\classes\olite36.jar;c:\progra~1\ora95_2\lite\designer\oldes.jar;c:\progra~1\ora95_2\lite\designer\swingall.j ar
PATH=C:\Progra~1\Ora95_2\bin;.;c:\Progra~1\jdk1.1.8\lib;c:\Progra~1\jdk1.1.8\bin;C:\Progra~1\Ora95_2\lite\Designer;C:\WIN95;C:\WIN95\COMMAND;C:\UTIL
And, I can run JAVA.EXE from any directory on command prompt.
With JAVA 2 SDK (ver 1.3 Beta) instead of JDK 1.1.8 I'm getting a different Error message as follows:
=============================
java.lang.NoClassFoundError: 'FILES\ORA95_2\LITE\DESIGNER\oldes.jar;C:\PROGRAM'
Please make sure that JDK 1.1.4 (or greater) is installed in your machine and CLASSPATH is set properly. JAVA.EXE must be in the PATH.
==============================
the PATH and CLASSPATH were set accordingly, as with JDK1.1.8, and there was no classes.zip in classpath
also the class file or the jar file looks weird or wrapped in the error message : 'FILES\ORA95_2\LITE\DESIGNER\oldes.jar;C:\PROGRAM'
Another interesting thing I noticed is if I run oldes.exe from Installation CD, the Oracle Lite Designer runs fine, and without error, I'm able to modify tables in the database of my laptop also.
Could someone shade some light on what am I doing wrong here ?
Thanks for help in advance .
Regards
Viral
nullOn 07/20/2015 06:35 AM, Itzhak Hovav wrote:
> hi
> [snip]
> [root@p22 eclipse]# cat eclipse.ini -startup
> plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
> --launcher.library
> plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807
>
> -showsplash
> org.eclipse.platform
> --launcher.XXMaxPermSize
> 256m
> --launcher.defaultAction
> openFile
> -vmargs
> -Xms40m
> -Xmx512m
> [snip]
Try this: http://wiki.eclipse.org/Eclipse.ini. You should have read the
sticky posts at forum's top for getting started help. -
Hi to all.
Currently, i am trying to install patches for portal server.
The server OS is Sun Solaris 8.
We are using Oracle9iAS.
Now, we are installing 9.0.1.4.0 patch set for the Oracle Database Server.
We managed to install the patch, but have problem with the Post Install Action.
We managed to run
-ALTER SYSTEM ENABLE RESTRICTED SESSION;
-@rdbms/admin/catpatch.sql
-ALTER SYSTEM DISABLE RESTRICTED SESSION;
-CONNECT / AS SYSDBA
-update obj$ set status=5 where type#=29 and owner#!=0;
-commit;
But, when we come to the next command, which is to shutdown, it gives us like
this..
SQL> update obj$ set status=5 where type#=29 and owner#!=0;
1402 rows updated.
SQL> commit;
Commit complete.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORA-00604: error occurred at recursive SQL level 1
ORA-01219: database not open: queries allowed on fixed tables/views only
We tried to startup the database..it gives us this error..
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
So, we tried to shutdown again..
SQL> shutdown immediate
ORA-01089: immediate shutdown in progress - no operations are permitted
I been informed that this is maybe a Database problem related. Any ideas?
Best Wishes,
Rushdan Md Saad.Patchsets could be obtained (only) from http://metalink.oracle.com
You need to have valid CSI for access.
P.S: Sorry Werner, I didn't see you post.
Message was edited by:
Ivan Kartik -
ORACLE_HOME_LISTNER is not SET dbstart error Oracle Enterprise Linux
ORACLE_HOME_LISTNER is not SET dbstart error Oracle Enterprise Linux
Hallo!I am a newbie in Oracle 10g having installed Oracle 10g in Oracle Enterprise Linux version 4 update 7.
I am trying to automate the startup of the Listener,Database,Enterprise Manager and isqlplus during boot.
I have tried running the dbstart script but an error resulted.After research,I found out that I am supposed to edit line 78 of the dbstart script from
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
To
ORACLE_HOME_LISTNER=$ORACLE_HOME
Even after this,when I run the dbstart script,I receive the error below.
[root@joey-oel ~]# cd /u01/app/oracle/product/10.2.0/db/bin/
[root@joey-oel bin]# ./dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Processing Database instance "orcl": log file /u01/app/oracle/product/10.2.0/db/startup.log
When I view the log file startup.log,the information is as below
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 9 21:20:33 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> ERROR:
ORA-12546: TNS:permission denied
SQL> ORA-12546: TNS:permission denied
SQL>
./dbstart: Database instance "orcl" warm started
./dbstart: Starting up database "orcl"
Sat Aug 14 15:30:25 EAT 2010
How do I resolve this?
Thanks.The results of the env | sort command is as below
[oracle@joey-oel ~]$ env | sort
_=/bin/env
EDITOR=gedit
G_BROKEN_FILENAMES=1
HISTSIZE=1000
HOME=/home/oracle
HOSTNAME=joey-oel.com
INPUTRC=/etc/inputrc
KDEDIR=/usr
LANG=en_US.UTF-8
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
LESSOPEN=|/usr/bin/lesspipe.sh %s
LOGNAME=oracle
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
MAIL=/var/spool/mail/oracle
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db
ORACLE_HOSTNAME=joey-oel.com
ORACLE_SID=orcl
PATH=/u01/app/oracle/product/10.2.0/db/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/home/oracle/bin
PWD=/home/oracle
QTDIR=/usr/lib/qt-3.3
SHELL=/bin/bash
SHLVL=1
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
TERM=vt100
TMPDIR=/tmp
TMP=/tmp
USER=oracle
I am trying to run the dbstart as the oracle user.When I try doing this as below
[oracle@joey-oel ~]$ $ORACLE_HOME/bin/dbstart $ORACLE_HOME
chmod: changing permissions of `/u01/app/oracle/product/10.2.0/db/startup.log': Operation not permitted
Processing Database instance "orcl": log file /u01/app/oracle/product/10.2.0/db/startup.log
Even when I try changing the permissions of startup.log as below,
chmod 777 startup.log
the error still appears. -
Nls_date_format in oracle 10g XE
Hi guys,
I've been trying to change the default date format in my instance of 10g XE. I could do it in Standard version just modifying the init script but I couldn't find a way to do it in XE.
I don't want to use "ALTER SESSION" since I really need to change the default date format and not just in the sesion.
Could you help me?
Cheers.You could create an after logon trigger as in following example :
SQL> sho user
USER is "SYS"
SQL> select sysdate from dual;
SYSDATE
24-MAY-07
SQL> create or replace trigger after_logon
2 after logon on database
3 begin
4 if user='TEST' then
5 execute immediate
6 'alter session set nls_date_format=''YYYY-mm-dd hh24:mi:ss''';
7 end if;
8 end;
9 /
Trigger created.
SQL> conn test/test
Connected.
SQL> select sysdate from dual;
SYSDATE
2007-05-24 15:56:55
SQL> conn system/manager
Connected.
SQL> /
SYSDATE
24-MAY-07
SQL> -
How to handle national character set datatypes in oracle?
Hi
Can anyone tell me how to handle national character set datatypes in oracle?
Thanks in advanceAnd for data manipulation, append "N" the literal values being used in the command.
The "N" indicates that the string is to be treated as Unicode Text.
For Example: insert into TableName (ColumnName) values (N'ValueToBeInserted'); -
I HAVE CREATED THE JAVA PROGRAM TO READ FROM EXCEL AND STORED INTO DATABASE,
i loaded the abc.class into oracle using loadjava command,
AND also created the procedure based on loaded class,
when i call the procedure, i got the error because i need to set classpath in oracle
i.e i need to SET the classpath for the classes12.jar , i set the path in environment variables,
when i run the .class file its working fine,
can any one tell me , how to set the classpath in oracle, or reference to classes12.jarYou don't set the classpath in Oracle; you set the environment variable CLASSPATH for your OS.
For example, it may looks like this in UNIX:
setenv CLASSPATH $CLASSPATH:$ORACLE_HOME/jlib/some_jar_file.jar -
Can Adavnced queues be set up beteen oracle 8.1.6 and oracle 10g
can Adavnced queues be set up beteen oracle 8.1.6 and oracle 10g? if so is there any document that talks about the AQ setup between 8.1.6 and 10g?
This forum is intended for members to provide feedback and
suggestions about OTN developer services. Please repost your
question in an appropriate database forum.
Best regards,
--OTN Team -
Need to call SET ROLE for Oracle before running report
Hi all,
does anyone know how I can call SET ROLE for Oracle with Crystal Reports, before running report? I'm using Crystal Reports 2008 to design report (with Server Oracle connection) and Java Reporting Component to run report within a J2EE apllication. If anyone has any idea, I'd greatly appreciate as I'm in trouble.
Thanks a lot.Just a thought...
If your report's datasource was an Oracle stored procedure, you could call a function to set the role from that SP
You would be in the same Oracle session from Report --> SP --> Function, so the role would be retained -
Oracle 11g or higher client is not installed or not set to Primary Oracle..
Hi all,
I have installed oracle 11g client on my machine. It connecting fine with the server throuhg sqlplus but when i connect my application that is developed in power builder, it prompts an errror message stated 'Oracle 11g or higher client is not installed or not set to Primary Oracle Home'. I have tried different solutions from different posts over the internet but colud not get fruitfull results.
Please help me out in this regard to continue...
Thanks & Regards,
Adil MukhtarAs already said, this looks like a powerbuilder issue, related to how it "finds" Oracle client/oci libraries.
Assuming this is on Windows, you could use Process Monitor from Sysinternals to watch what your app does (e.g. where it looks for dll's). It's a great troubleshooting tool: http://technet.microsoft.com/en-us/sysinternals/bb896645
Google provides some results with similar issues. Maybe you have tried most of it already, but at least as a reference for others: http://lmgtfy.com/?q=powerbuilder+%22oracle11g+or+higher+client+is+not+installed%22
Maybe you are looking for
-
Disable/Hide the Refresh Button in Child report
Hi All, Our Environment is BOXI-R2; We have a Master Report calling a Child Report (based on Open Document); Our requirement is to hide the" Refresh Button "in the child report Layout we tried using "hideRefresh=true" but the child report is not resp
-
My 2009 Macbook Pro's Safari doesn't show the tool bar anymore. I can click on a diagonal arrow in the upper right corner that appears when I put my cursor there and the tool bar will show, but then it disappears again. Also, when I get an email an
-
How to delete all the PSA data in one go
Hello Guys, I want to clear all the data from all the PSA tables at one shot, how can i do this?? I have tried following things: 1) I have gone to PSA root node and right click and then clicked on delete PSA data, but its showing me all the datasourc
-
Why do some users see a document information panel and some do not?
I asked this in the MS Office forum and haven't received an answer that explains why some users can see the data some cannot. We have customers that connect to our online multitenant SharePoint application. They use MS Office 2010. Some of the users
-
Problems binding push button to NSArrayController
I've got a text field that is bound to a selection value from an NSArrayController. I'd like to create a button that populates that text field with an automatically generated value. I thought the solution was to bind the button to a simple controller