Results 1 to 6 of 6

Thread: Urgent -How to save not latin dates?

  1. #1
    Join Date
    Jul 2005
    Posts
    35

    Unhappy Urgent -How to save not latin dates?

    Hi there,
    Is there anybody knows how can I save not latin dates in Oracle? I mean for example: Jalali(shamsi) calender or Arabic Calender(Hijri) instead of using Julian Calendar.
    Currently we do this by saving this dates in varchar type and another equivalent Latin datetime(e.g. 2 columns).We perform operations on Latin and then manipulate the varchar column and ofcourse application always will see this varchar column.
    -Thanks alot

  2. #2
    Join Date
    Mar 2003
    Posts
    468
    Oracle stores date data types in their own internal format which i believe is an offset from some point in time.

    anyway, To use a different calendar for display you need only set the NLS_CALENDAR environment variable. Also note that your O/S character set must be able to handle this display.

    alter session set NLS_CALENDAR="Arabic Hijrah";

  3. #3
    Join Date
    Jul 2005
    Posts
    35

    Question

    Thanks jkoopmann,
    I want to do this in system level not in session level.This way I should not set it for every session,Am I right?
    Is it possible to alter session set nls_calendar='Persian' using a trigger? Doesn't this beat the performance?
    -Thanks for yout help

  4. #4
    Join Date
    Mar 2003
    Posts
    468
    yes you can set to Persian
    yes you could use a logon trigger to do this.
    if you want the setting for everyone then you should set in the init.ora parameter file as this is also a system setting.

  5. #5
    Join Date
    Jul 2005
    Posts
    35
    Thanks Jemes,
    I got the point.But when I tried to set nls_calendar parameter in init.ora and restart Oracle it does not start and says invalid parameter....
    What shoud I do?

  6. #6
    Join Date
    Mar 2003
    Posts
    468
    Ach,
    Sorry, Oracle documentation said both SESSION & SYSTEM modifiable but I just did another look at it is only SESSION modifiable.

    Code:
    SQL > select name,isses_modifiable,issys_modifiable from v$parameter where name = 'nls_calendar';
    
    NAME                 ISSES ISSYS_MOD
    -------------------- ----- ---------
    nls_calendar         TRUE  FALSE

    You would have to use a logon trigger or some other means.
    here is a logon trigger if you need one to change.
    Code:
    CREATE OR REPLACE TRIGGER LOGON_TRIGGER
    AFTER LOGON ON DATABASE
    DECLARE
    BEGIN
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_CALENDAR=''English Hijrah''';
    END;
    /

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •