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,
Mike

Here'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

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  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

  • How to execute the ' alter session set NLS_DATE_FORMAT='YYYYMMDD'  in the procedure??

    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

  • How do you set nls_date_format in APEX

    I tried to create a application level process to do this, but when I hit debug on page loads I still see "NLS: Set date format="DD-MON-RR"" every page load and my date values are still getting passed as this format.
    Also unrelated, anyone know how to change your password for this forums, I'm tired of having to recover password every time I want to sign in. I've never seen a forum before hide the change your password so well.

    Never mind, finally found it.
    Home>Application Builder>Application 125>Shared Components>Edit Globalization Attributes

  • In Oracle 10g global support system,I set parameter of NLS_DATE_FORMAT.(98)

    In Oracle 10g global support system,I have set parameter of NLS_DATE_FORMAT.I am wondering about that whether it could affect the default value of NLS_TIMESTAMP_FORMAT?
    Message was edited by:
    frank.qian

    test@ORCL> select sysdate from dual;
    SYSDATE
    24-NOV-06
    Elapsed: 00:00:00.00
    test@ORCL> DECLARE
      2     checkout TIMESTAMP(3);
      3  BEGIN
      4     checkout := '22-JUN-2004 07:48:53.275';
      5     DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
      6  END;
      7  /
    22-JUN-04 07.48.53.275 AM
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    test@ORCL> alter session set nls_date_format="MM/DD/YYYY";
    Session altered.
    Elapsed: 00:00:00.00
    test@ORCL> select sysdate from dual;
    SYSDATE
    11/24/2006
    Elapsed: 00:00:00.00
    test@ORCL> DECLARE
      2     checkout TIMESTAMP(3);
      3  BEGIN
      4     checkout := '22-JUN-2004 07:48:53.275';
      5     DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
      6  END;
      7  /
    22-JUN-04 07.48.53.275 AM
    PL/SQL procedure successfully completed.
    test@ORCL> alter session set NLS_TIMESTAMP_FORMAT = 'DD/MM/YYYY HH:MI:SS.FF';
    Session altered.
    Elapsed: 00:00:00.00
    test@ORCL> DECLARE
      2     checkout TIMESTAMP(3);
      3  BEGIN
      4     checkout := '22-JUN-2004 07:48:53.275';
      5     DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
      6  END;
      7  /
    22/06/2004 07:48:53.275
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    test@ORCL>
    test@ORCL>

  • Result set of One db to another DB

    Dear All,
    Need your help.
    I am posting my sample class below
    public static java.sql.ResultSet getData(String dbConnectStr,String dbuserID,String dbpwd,String query) throws Exception
    // Obtain default connection
    // Query all columns from the EMP table
    ResultSet rset = null;
    Connection conn = null;
    try
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    conn = (OracleConnection)DriverManager.getConnection("jdbc:oracle:thin:@"+dbConnectStr,dbuserID,dbpwd);
    ((OracleConnection)conn).setCreateStatementAsRefCursor(true);
    stat.execute("alter session set NLS_DATE_FORMAT='DD-Mon-RRRR HH:MI:SS'");*/
    System.out.println(query);
    Statement stmt = conn.createStatement();
    rset = stmt.executeQuery(query);
    System.out.println("returning");
    catch (SQLException e)
    e.printStackTrace();
    // Return the ResultSet (as a REF CURSOR)
    return rset;
    ################################## My Function in Oracle DB
    FUNCTION DB_CALL(dbConnectStr VARCHAR2,dbuserID VARCHAR2,dbpwd VARCHAR2,query VARCHAR2) return axsbcstatement.CUR is language java name 'com.axs.logc.OracleDeployProcedure.getData(java.lang.String,java.lang.String,java.lang.String,java.lang.String) return java.sql.Resultset' ;
    ########################### My Procedure Where i am calling this function
    PROCEDURE INSERT_call (inward_dbConnectStr VARCHAR2,inward_dbuserID VARCHAR2,inward_dbpwd VARCHAR2,query VARCHAR2,updateCnt out number) as
    up_cnt number(6) :=0;
    db_cur axsbcstatement.inward_cur;
    ENTRY_NMBR_field dummy_table.Entry_Nmbr%type;
    SNDR_NAME_field dummy_table.Sndr_Name%type;
    SNDR_ADDRSS_field dummy_table.Sndr_Addrss%type;
    RCVR_NAME_field dummy_table.Rcvr_Name%type;
    REMARKS_field dummy_table.Remarks%type;
    TRAN_AMNT_field dummy_table.Tran_Amnt%type;
    TRAN_DATE_field dummy_table.Tran_Date%type;
    BATCH_TRANID_field dummy_table.Batch_Tranid%type;
    BATCH_TIME_field dummy_table.Batch_Time%type;
    BEGIN
    db_cur := INWARD_DB_CALL(inward_dbConnectStr,inward_dbuserID ,inward_dbpwd ,query);
    loop
    fetch db_cur into ENTRY_NMBR_field,TRAN_ID_field,SNDR_NAME_field,SNDR_ADDRSS_field,RCVR_NAME_field,REMARKS_field,TRAN_DATE_field,BNFCRY_field,BATCH_TRANID_field,BATCH_TIME_field;
    EXIT WHEN db_cur%NOTFOUND;
    begin
    select ENTRY_NMBR INTO ENTRY_NMBR_field from dummy_table where ENTRY_NMBR = entry_nmbr_field and TRAN_ID = TRAN_ID_field;
    if SQL%found then
    dbms_output.put_line('Data Found in table ');
    end if;
    Exception
    when no_data_found then
    insert into dummy_table values(ENTRY_NMBR_field,TRAN_ID_field,SNDR_NAME_field,SNDR_ADDRSS_field,RCVR_NAME_field,REMARKS_field,TRAN_DATE_field,BNFCRY_field,BATCH_TRANID_field,BATCH_TIME_field);
    up_cnt := up_cnt+1;
    end;
    end loop;
    close db_cur;
    updateCnt := up_cnt;
    Exception
    when others then
    dbms_output.put_line(' - ' || SQLCODE|| ' ' ||SQLERRM);
    END INSERT_call;
    I am getting "ORA-00932: inconsistent datatypes: expected a return value that is a java.sql.ResultSet got a java.sql.ResultSet that can not be used as a REF CURSOR" this error while executing the procedure...
    i have tried so many things but not able to solve this problem..
    Apart from this If someone suggest me ...........
    I am having two different database.with same table structure .
    i have to take data from db1 and insert into the db2 on incremental basis (some checks required while inserting into the db2)
    Regards .
    Salil

    Just modify your procedure like this
    CREATE OR REPLACE PROCEDURE insert_call (
       inward_dbconnectstr         VARCHAR2,
       inward_dbuserid             VARCHAR2,
       inward_dbpwd                VARCHAR2,
       QUERY                       VARCHAR2,
       updatecnt             OUT   NUMBER
    AS
       up_cnt               NUMBER (6)                      := 0;
       db_cur               axsbcstatement.inward_cur;
    --   entry_nmbr_field     dummy_table.entry_nmbr%TYPE;
    --   sndr_name_field      dummy_table.sndr_name%TYPE;
    --   sndr_addrss_field    dummy_table.sndr_addrss%TYPE;
    --   rcvr_name_field      dummy_table.rcvr_name%TYPE;
    --   remarks_field        dummy_table.remarks%TYPE;
    --   tran_amnt_field      dummy_table.tran_amnt%TYPE;
    --   tran_date_field      dummy_table.tran_date%TYPE;
    --   batch_tranid_field   dummy_table.batch_tranid%TYPE;
    --   batch_time_field     dummy_table.batch_time%TYPE;
       all_rec              dummy_table.%ROWTYPE;
    BEGIN
       db_cur := inward_db_call (inward_dbconnectstr, inward_dbuserid, inward_dbpwd, QUERY);
       LOOP
          FETCH db_cur
           INTO all_rec;
          EXIT WHEN db_cur%NOTFOUND;
          BEGIN
             SELECT entry_nmbr
               INTO entry_nmbr_field
               FROM dummy_table
              WHERE entry_nmbr = all_rec.entry_nmbr AND tran_id = all_rec.tran_id;
             IF SQL%FOUND
             THEN
                DBMS_OUTPUT.put_line ('Data Found in table ');
             END IF;
          EXCEPTION
             WHEN NO_DATA_FOUND
             THEN
                INSERT INTO dummy_table
                     VALUES (all_rec.entry_nmbr, all_rec.tran_id, all_rec.sndr_name, all_rec.sndr_addrss, all_rec.rcvr_name, all_rec.remarks, all_rec.tran_date,
                             all_rec.bnfcry, all_rec.batch_tranid, all_rec.batch_time);
                up_cnt := up_cnt + 1;
          END;
       END LOOP;
       CLOSE db_cur;
       updatecnt := up_cnt;
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line (' - ' || SQLCODE || ' ' || SQLERRM);
    END insert_call;Regards,
    Mahesh Kaila

  • Can't get NLS_DATE_FORMAT from windows regedit

    My windows version is xp, and I do set NLS_DATE_FORMAT = 'YYYY/MM/DD HH24:MI:SS' in register table, and I use oracle SQL*worksheet, when I query
    select sysdate from dual,
    it will get the date which format exactly like 'YYYY/MM/DD HH24:MI:SS' ;
    But When I query in SQL*Developer:
    select sysdate from dual
    it will get the date which format exactly like 'DD-MMM-YY'
    I just wonder why SQL*Developer doesn't use NLS_DATE_FORMAT in register table but use the default date format?
    Thanks

    I don't know the why, just that it doesn't pull that setting from windows. It is probably related to it being written in java.
    Anyways, in 1.0, you need to setup a login trigger to set the date format at login. There are examples of how to do this if you search the forum.
    In the 1.1 eval version, there is a setting in tools -> preferences -> Database -> nls parameters.
    Eric

  • NLS setting chnage Issue

    Hi
    I did the following steps to change the session parameter. Even though I got the same results after doing so.
    Any suggestions....
    DB - 10gR2 on vista
    SELECT * FROM nls_session_parameters  --> DD.MM.YYYY HH24:MI:SS
    SELECT SYSDATE FROM dual  -->  21-Nov-2009 11:26:11
    ALTER SESSION SET nls_date_format = 'DD.MM.YYYY HH24:MI:SS';
    SELECT * FROM nls_session_parameters --> MM.DD.YYYY HH24:MI:SS
    SELECT SYSDATE FROM dual   --> 21-Nov-2009 11:26:11rgds
    shabar

    Hi,
    For me its working on 10GXE on XP.
    SQL> select sysdate from dual;
    SYSDATE
    23.11.2009 04:56:53
    SQL>  alter session set nls_date_format ='MM.DD.YYYY HH24:MI:SS';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    11.23.2009 04:57:50
    SQL>Regards,

  • NLS_DATE_FORMAT.

    Hi All,
    alter sesssion set nls_date_format = 'dd/mm/yyyy' executed fine but when I ran the following command
    select * from v$nls_parameters, nls_date_format is still mm/dd/yyyy. Can anybody help.
    My actual intention is to store the log_date in the table in "dd/mm/yyyy hh:mi" format. My Form will input the value as 23/05/2012 21:03
    Can I also request how can i achieve this please?

    select * from nls_database_parameters where lower(parameter) =  'nls_date_format';
    select * from nls_instance_parameters where lower(parameter) =  'nls_date_format';
    select * from nls_session_parameters where lower(parameter) =  'nls_date_format';
    alter session set nls_date_format = 'dd/mm/yyyy' ;
    select * from nls_database_parameters where lower(parameter) =  'nls_date_format';
    select * from nls_instance_parameters where lower(parameter) =  'nls_date_format';
    select * from nls_session_parameters where lower(parameter) =  'nls_date_format';
    PARAMETER                      VALUE                                  
    NLS_DATE_FORMAT                DD-MON-RR                              
    1 row selected.
    PARAMETER                      VALUE                                  
    NLS_DATE_FORMAT                                                       
    1 row selected.
    PARAMETER                      VALUE                                  
    NLS_DATE_FORMAT                DD.MM.RR                               
    1 row selected.
    Session altered.
    PARAMETER                      VALUE                                  
    NLS_DATE_FORMAT                DD-MON-RR                              
    1 row selected.
    PARAMETER                      VALUE                                  
    NLS_DATE_FORMAT                                                       
    1 row selected.
    PARAMETER                      VALUE                                  
    NLS_DATE_FORMAT                dd/mm/yyyy                             
    1 row selected.

  • NLS_date_format in triggers

    Hi everyone
    Please tell what NLS settings are for trigger sessions, for example i make update on table where there are trigger
    which make some inserts and update on other tables on string column but with date datatype, so how this date will be formatted in this string column,(there is no to_char setting) , does trigger get NLS setting from session which fire that trigger or are taken from instance level?
    Best regards
    thx

    913813 wrote:
    Hi everyone
    Please tell what NLS settings are for trigger sessions, for example i make update on table where there are trigger
    which make some inserts and update on other tables on string column but with date datatype, so how this date will be formatted in this string column,(there is no to_char setting) , does trigger get NLS setting from session which fire that trigger or are taken from instance level?
    Best regards
    thxI second Sybrands comments on not storing dates as strings. It is a really bad idea.
    As to your question, what stops you from running a quick test to see what happens. This took me all of 5 minutes:
    SQL> create table t (real_date date,
      2                  string_date varchar2(25),
      3                  nls_mask varchar2(25));
    Table created.
    SQL> create trigger t_bi
      2     before insert on t
      3     for each row
      4  begin
      5     :new.string_date := :new.real_date;
      6  end;
      7  /
    Trigger created.
    SQL> select parameter, value from v$nls_parameters
      2  where parameter = 'NLS_DATE_FORMAT';
    PARAMETER        VALUE
    NLS_DATE_FORMAT  DD-MON-FXYYYY
    SQL> insert into t (real_date, nls_mask)
      2  values (sysdate, 'Default');
    1 row created.
    SQL> alter session set nls_date_format = 'dd/mm/yyyy hh24:mi:ss';
    Session altered.
    SQL> insert into t (real_date, nls_mask)
      2  values (sysdate, 'dd/mm/yyyy hh24:mi:ss');
    1 row created.
    SQL> alter session set nls_date_format = 'yyyy-Mon-dd hh24:mi:ss';
    Session altered.
    SQL> insert into t (real_date, nls_mask)
      2  values (sysdate, 'yyyy-Mon-dd hh24:mi:ss');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t;
    REAL_DATE            STRING_DATE               NLS_MASK
    2012-Mar-12 10:50:55 12-MAR-2012               Default
    2012-Mar-12 10:52:20 12/03/2012 10:52:20       dd/mm/yyyy hh24:mi:ss
    2012-Mar-12 10:53:13 2012-Mar-12 10:53:13      yyyy-Mon-dd hh24:mi:ss
    SQL> alter session set nls_date_format = 'dd-mon-yyyy';
    Session altered.
    SQL> select * from t;
    REAL_DATE   STRING_DATE               NLS_MASK
    12-mar-2012 12-MAR-2012               Default
    12-mar-2012 12/03/2012 10:52:20       dd/mm/yyyy hh24:mi:ss
    12-mar-2012 2012-Mar-12 10:53:13      yyyy-Mon-dd hh24:mi:ssJohn

  • Setting Correct Time in Oracle 8i Enterprise Edition

    If I run a SQL command Select sysdate from dual, it shows the date correctly, but the time is one hour ahead. How can I correct this?
    Regards,
    Jim Rodenberger
    [email protected]

    Jim,
    I'm not sure how to change the time permanently. I don't know if you're in the wrong time zone or what, but I know how to display it correctly:
    First, set your nls_date_format to show the hour, etc.(you may set this to permanent instead of just for the session:
    SQL>ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
    SQL>SELECT NEW_TIME(SYSDATE, 'CST', 'CDT')
    1> FROM DUAL;
    The new_time() function accepts and requires 3 parameters. The first being a date and time, the second being the time zone the first parameter belongs in, and the last parameter being the time zone you would like to convert to. Each time zone is abbreviated in the following way: XST or XDT, where S or D stands for standard or daylight saving time, and where X stands for the first letter of the time zone (such as Atlantic, Bering, Central, Eastern, Hawaii, Mountain, Newfoundland, Pacific, or Yukon. There are two exceptions: Greenwich mean time is indicated by GMT, while Newfoundland standard time does not use daylight saving. This is in the Oracle 8i Certified Professional DBA Certification Exam Guide page 48.
    Hope this helps,
    Rob
    If I run a SQL command Select sysdate from dual, it shows the date correctly, but the time is one hour ahead. How can I correct this?
    Regards,
    Jim Rodenberger
    [email protected]

  • 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>

  • NLS_DATE_FORMAT on database level?

    Hi all,
    I would like to change the NLS_DATE_FORMAT parameter so that the change will be reflected in the NLS_DATABASE_PARAMETERS view. I always thought it would be alter system, but that only changes it for all newly connecting sessions. Appearantly this can also be set on a database level. What is this database level? What does it mean if the two are different? See details below.
    Thanx in advance,
    Lennert
    SQL> select * from nls_database_parameters where parameter like
    SQL> 'NLS_DA%';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              AMERICAN
    SQL> select * from nls_session_parameters where parameter like
    SQL> 'NLS_DA%';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                DD-MM-RR
    NLS_DATE_LANGUAGE              DUTCH
    SQL> alter system set nls_date_format='DD-MM-YYYY' scope = spfile;
    System altered.
    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup open
    ORACLE instance started.
    Database mounted.
    Database opened.
    SQL>  select * from nls_database_parameters where parameter like
    SQL> 'NLS_DA%';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                DD-MON-RR      ---> still the same, why?
    NLS_DATE_LANGUAGE              AMERICAN     ---> still the same, why?
    SQL> select * from nls_session_parameters where parameter like
    SQL> 'NLS_DA%';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                DD-MM-YYYY   ---> changed
    NLS_DATE_LANGUAGE              DUTCH           ---> changed
    SQL>

    SQL> alter system set nls_date_format='DD-MM-YYYY' scope = spfile;
    SQL> select * from nls_database_parameters where parameter like
    SQL> 'NLS_DA%';
    NLS_DATE_FORMAT DD-MON-RR ---> still the same, why?It is because "alter system" has changed instance parameter and not database parameter.
    When you query nls_instance_parameters then you will see that nls_date_format parameter has changed.
    Note there are three views:
    1. nls_session_parameters - settings at session level, change can be made using "alter session".
    2. nls_instance_parameters - settings at instance level, taken from parameter file (pfile/spfile) change can be made using "alter system"
    3. nls_database_parameters - settings at database level, set during DB creation, you can't change them.
    What is this database level? What does it mean if the two are different? See details below.http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/intro.htm#sthref11
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14225/ch3globenv.htm#sthref217

Maybe you are looking for