AfterConnect.SQL - format ?

Dave Sharpe

Member²
I've Developer 7.0.2 --
I've seen in earlier posts that NLS_DATE_FORMAT can be set in AfterConnect.SQL.

I see no guidance in the help nor the PDF manual as to the correct structure for doing it.

I'm doing some work with Crystal Reports and they force Oracle into
"NLS_DATE_FORMAT YYYY/MM/DD HH24:MI:SS" which I need to duplicate in developer.

I also saw that I might be able to do it via "Preference" but was unable to do so. I created a new "personal preference" and set date format for it, but it seemed that no matter what I did all preference selections had the same date format.

Should I have been able to to it that way ?

If yes any thoughts on what I might be doing wrong (or some step that I might have overlooked ?

Thanks
Dave
 
Dave,

AfterConnect.sql (and Login.sql for that matter) is regular SQL script. So you just need to add following line

Code:
alter session set NLS_DATE_FORMAT = 'YYYY/MM/DD HH24:MI:SS';
And here are the results

Code:
SQL> select value from v$nls_parameters where parameter = 'NLS_DATE_FORMAT';

VALUE
----------------------------------------------------------------
YYYY/MM/DD HH24:MI:SS

SQL> select to_char(sysdate) from dual;

TO_CHAR(SYSDATE)
-------------------
2006/08/17 16:08:03
 
Back
Top