Constant dates gets different values when instantiated using different cale

Hi,
I have a package that's like this:
CREATE OR REPLACE PACKAGE DATABASE_SYS IS
first_julian_day_ CONSTANT NUMBER := 2378211;
last_julian_day_ CONSTANT NUMBER := 2545125;
first_calendar_date_ CONSTANT DATE := to_date(first_julian_day_, 'J');
last_calendar_date_ CONSTANT DATE := to_date(last_julian_day_, 'J');
FUNCTION Get_First_Calendar_Date RETURN DATE DETERMINISTIC;
PRAGMA restrict_references(Get_First_Calendar_Date, WNDS);
FUNCTION Get_Last_Calendar_Date RETURN DATE DETERMINISTIC;
PRAGMA restrict_references(Get_Last_Calendar_Date, WNDS);
END DATABASE_SYS;
CREATE OR REPLACE PACKAGE BODY DATABASE_SYS IS
FUNCTION Get_First_Calendar_Date RETURN DATE DETERMINISTIC
IS
BEGIN
RETURN first_calendar_date_;
END Get_First_Calendar_Date;
FUNCTION Get_Last_Calendar_Date RETURN DATE DETERMINISTIC
IS
BEGIN
RETURN last_calendar_date_;
END Get_Last_Calendar_Date;
END DATABASE_SYS;
If using two different SQLPlus sessions:
First session
SQL> ALTER SESSION SET nls_calendar='PERSIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date, 'YYYY-MM-DD') FROM dual
2 /
TO_CHAR(DA
1799-03-21
SQL>
SQL> ALTER SESSION SET nls_calendar='GREGORIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date, 'YYYY-MM-DD') FROM dual
2 /
TO_CHAR(DA
2420-06-10
SQL>
SQL> ALTER SESSION SET nls_calendar='PERSIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date, 'YYYY-MM-DD') FROM dual
2 /
TO_CHAR(DA
1799-03-21
SQL>
SQL> ALTER SESSION SET nls_calendar='GREGORIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date, 'YYYY-MM-DD') FROM dual
2 /
TO_CHAR(DA
2420-06-10
SQL>
Second session:
SQL> ALTER SESSION SET nls_calendar='GREGORIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date,'YYYY-MM-DD') FROM dual
2 /
TO_CHAR(DA
1799-03-21
SQL>
SQL> ALTER SESSION SET nls_calendar='PERSIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date, 'YYYY-MM-DD') FROM dua
l
2 /
TO_CHAR(DA
1178-01-01
SQL>
SQL> ALTER SESSION SET nls_calendar='GREGORIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date,'YYYY-MM-DD') FROM dual
2 /
TO_CHAR(DA
1799-03-21
SQL>
SQL> ALTER SESSION SET nls_calendar='PERSIAN'
2 /
Session õr õndrad.
SQL> SELECT to_char(database_sys.Get_First_Calendar_Date, 'YYYY-MM-DD') FROM dua
l
2 /
TO_CHAR(DA
1178-01-01
SQL>
Why does the dates differ?
Should not the dates be the same?
Should not Julian dates always be the same regardless of my session parameters?
What am I missing here?
Regards
Håkan

The problem seems to be with Julian date conversion code being sensitive to the user calendar, while it should not be:
SQL> alter session set nls_date_format='YYYY-MM-DD';
Session altered.
SQL> select to_date('2378211','J','NLS_CALENDAR=GREGORIAN') from dual;
TO_DATE('2
1799-03-21
SQL> select to_date('2378211','J','NLS_CALENDAR=PERSIAN') from dual;
TO_DATE('2
2420-06-10
I have logged bug #5386942. If you want to follow this bug, you have to contact Oracle Support.
As a workaround, specify explicit third parameter 'NLS_CALENDAR=GREGORIAN' in your TO_DATE() calls.
-- Sergiusz

Similar Messages

  • Xml: how to get node value when pasing node name as a parameter

    Hi,
    I've got some xml:
    var xmlData:XML =
    <1stNode>
        <buttonID>first child node value</buttonID>
        <imageID>second child node value</imageID>
        <labelID>third child node value</labelID>
    </1stNode>
    Then I want to read specific node value based on a value passed to a function. .
    var buttonID = new Button;
    var imageID = new Image;
    var labelID = new Label;
    getNodeValue(buttonID); //the value here is set dynamically
    private function getNodeValue (nodeName:String):void {
    trace (xmlData.nodeName)                      //doesn't work
    var str:String = "xmlData." + nodeName;
    var xml:XMLList = str as XMLList             //doesn't work
    I'm don't know how to get the value when node name is dynamically changed.

    use:
    getNodeValue(buttonID); //the value here is set dynamically
    private function getNodeValue (nodeName:String):void {
    trace (xmlData[nodeName])                    

  • Why i dont get email notifications when someone uses my apple account to know my location through Find my Iphone?

    Why i dont get email notifications when someone uses my apple account to know my location through Find my Iphone?

    Try adding [email protected] as a VIP contact in your icloud mail app using the appleid used for icloud if using multiple accounts (i.e different itunes and icloud account).
    But seriously that happens really !? not getting emails for using icloud services with a valid appleid.

  • I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    Logged the call with SAP who directed me to 'Define settings for attachments' in IMG and setting the 'Deactivate Java Applet' & 'Deactivate Attachment versioning' checkboxes - problem solved.

  • Same thing is happening to me. Adobe has not responded to anyone about this error. It appears that Abobe XI is not compatible with IE 11.  I do not get this error when I use Chrome or Firefox. Only IE 11 does this. I have tried clearing cache and cookies.

    Same thing is happening to me. Adobe has not responded to anyone about this error. It appears that Abobe XI is not compatible with IE 11.  I do not get this error when I use Chrome or Firefox. Only IE 11 does this. I have tried clearing cache and cookies. I even uninstalled and re-installed IE 11. It is still doing it.  I am surprized that a company like Adobe would just ignore our posts and leave us hanging this this.
    Error message is FAILED TO GET DISPATCH FROM IBRWSR2.  Then when you click on it the next error message says:  PHTML IS NULL. You have to click this error message twice and then the PDF finally loads. Happened every time
    Does anyone have a solution since Adobe will not respond?
    As a last resort I will try uninstalling the Adobe Reader XI and install Adobe Reader 10 instead. It seems to work ok. But when I try to install version 10 the Adobe site tries to install XI.  Any ideas?
    JimP08758

    It worked just fine for me.
    Many site issues can be caused by corrupt cookies or cache.
    * Clear the Cache and
    * Remove Cookies '''''Warning ! ! '' This will log you out of sites you're logged in to.'''
    Type '''about:preferences'''<Enter> in the address bar.
    * '''Cookies;''' Select '''Privacy.''' Under '''History,''' select Firefox will '''Use Custom Settings.''' Press the button on the right side called '''Show Cookies.''' Use the search bar to look for the site. Note; There may be more than one entry. Remove '''All''' of them.
    * '''Cache;''' Select '''Advanced > Network.''' Across from '''Cached Web Content,''' Press '''Clear Now.'''
    If there is still a problem,
    '''[https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode Start Firefox in Safe Mode]''' {web link}
    While you are in safe mode;
    Type '''about:preferences#advanced'''<Enter> in the address bar.
    Under '''Advanced,''' Select '''General.'''
    Look for and turn off '''Use Hardware Acceleration'''.
    Poke around safe web sites. Are there any problems?
    Then restart.

  • Trouble with slow Macbook Air. I have first generation MacBook Air and have a hard time keeping hard drive from being full. Right now, I have almost 5 gigs available, but mac is slow and I keep getting color wheel when I use Mail. Any suggestions?

    Trouble with slow Macbook Air. I have first generation MacBook Air and have a hard time keeping hard drive from being full. After trashing many docs, I have almost 5 gigs available, but mac is slow and I keep getting color wheel when I use Mail. I'd like to install Lion, but now I'm afraid it will slow down my machine even further. Do I have enough free hard disc space? Is Mail problem related to free hard disc space? Thanks for your help!

    7gb of free disc space is required to install Lion.  Read this about how to free up disc space: http://pondini.org/OSX/DiskSpace.html.  Also, advice on how to speed up your mac: http://www.maclife.com/article/feature/25_ways_speed_your_mac

  • My iphone 4s camera is getting switch off when i use

    My iphone 4s camera is getting switch off when i use and when i use HDR function in the camera its getting switch off after taking picture and I wont see the picture where I have taken, can any one help me out in this or I should go to service center

    Uninstall the app and reinstall it. If it persists dont use it. simple

  • My iPad getting very warm when i use it for bit in longer time

    Why my ipad is getting very warm when i use it for bit in longer time, any body has same experience?, Why my ipad is getting very warm when i use it for bit in longer time, any body has same experience?

    The Temperature warning usually appears when the iPad has been set in a place where it gets so hot to the touch that you'd almost burn your hands if you picked it up. The temperature caused by the processor or charging the battery should never reach that level. If you feel your pad is too warm when you are using it Make an appointment at an Apple Store to have your device examined by a technician. Or contact Apple Support.

  • Am getting error  error when am using  wm_concat funcation.

    hi all
    am getting error error when am using wm_concat funcation.
    SQL> DECLARE
    2 ex VARCHAR2(200);
    3 BEGIN
    4 SELECT wm_concat(ename) INTO EX FROM EMP WHERE deptno=30;
    5 DBMS_OUTPUT.PUT_LINE(EX);
    6 END;
    7
    8 .
    SQL>
    SQL> /
    DECLARE
    ERROR at line 1:
    ORA-06550: line 4, column 10:
    PL/SQL: ORA-00904: "WM_CONCAT": invalid identifier
    ORA-06550: line 4, column 3:
    PL/SQL: SQL Statement ignoredThanks for all in advance
    Edited by: maddy on 9 Jan, 2012 10:02 PM

    >
    WM_CONCAT is undocumented and unsupported by Oracle, meaning it should not be used in production systems.
    >
    so change your way
    btw
    for me
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> set serveroutput on
    SQL> DECLARE
      2   ex varchar2(200);
      3   BEGIN
      4   SELECT wm_concat(ename) INTO EX FROM EMP WHERE deptno=30;
      5   DBMS_OUTPUT.PUT_LINE(EX);
      6   END;
      7  /
    ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
    PL/SQL procedure successfully completed.
    SQL> try wmsys.wm_concat

  • My ipod touch won't hold a charge and gets really hot when im using it. what is going on?

    my ipod touch won't hold a charge and gets really hot when im using it. what is going on?

    Likely that the battery is dead.  I would make an appointment at the Genius Bar of an Apple store to confirm. Apple will replace the battery for this price:
    Apple - Support - iPod - Repair pricing
    There are third-party places which may be less expensive.  Here is one. Google for more.
    DigiExpress.us - The iPad Repair Professionals

  • What should i do if my ipod is getting really hot when i use it/

    I need help my ipod keeps getting really hot when i use it

    I would suggest you stop use for a period of time until it cools down. When you turn it off, make sure you exit out of whatever program you are running. If it persists getting hotter, to the point where it's hard to hold, I would suggest you take it into the Apple store nearest you. Depending on how long you have had it, they may be able to replace it for you free of charge.
    It is abnormal for that device to get extremely hot but when it is running multiple programs, such as playing music and surfing safari, it can heat up.

  • Why does my form data gets cleared out when clicking on the back button.

    Can someone explain why does my form selections get cleared out when clicking on the back button.
    I have a JSP page that displays a form with some selections and text boxes. I populate the page and submit the request. The action on the submit call another jsp page, which processes the data and displays the results via a <jsp:include> statement which calls the results page. When clicking on the back button from the results page, it returns me to the form page, but the selections are cleared out.
    1. Is there something in my calling of the pages that causes this behavior and can I prevent it?
    I notice that the behavior is different when using the IE 6.0 version Netscape 7.1. IE clears the page Netscape 7.1 retains the settings.
    If I cannot prevent this behavior does that mean I will have to save the state of the form data. And if I have to save the form data, what would be the easiest method of doing this. I'm a beginner to JSP and Java, but have some ASP experience. I don't understand why the back button in a JSP request clears the form data but a regular HTML page does not can someone explain?
    THANKS.

    the browser doesn't have to remember what you submitted and fill that back in.
    you can't prevent it unless you can ensure a new request to the server in which you can fill the default values in there.

  • How to Get the value when clicking on the link

    I had a problem with when clicking on the link.
    I need get the link value to the controller when clicking on the link.
    I am displaying the database columns in jsp using repeater in links.
    I am displaying the data like this:
    RED
    BLUE
    GREEN
    these are three links.when clicking on the link RED. RED should go to the controller.
    After getting RED to the controller i will get the RED value from the database.

    my requirement is like that only
    I have just given the example of emp and dept
    emp(empno,zone_group_id,zone_id,deptno,ename,emp_p_ind,last_update_datetime);
    dept_emp(empno,dept_no,loc,dname,sal_emp,grade,last_update_datetime);
    CREATE OR REPLACE VIEW emp_zone AS
    SELECT e.empno,
          (select zone_group_id from price_zone_group where rownum = 1) zone_group_id,
           d.loc zone_id,    
           d.grade,  
           d.last_update_datetime,
      FROM dept_emp d
          emp e
    WHERE d.empno=e.empno
       AND e.emp_p_ind = 'Y'
      WITH READ ONLY;
    Now
    my requirement is to get the data of emp_zone view and needs to store those data into some other temp table
    if any of the above base table got updated deleted or inserted then the view last_updatetime also will get updated but problem is why im not using base table
    direct because it is having huge data and it performance issue .i have to get the value on the basis of view only and using some logic

  • Getting Error :Error when instantiating WebService runtime

    Hello All,
                  I am a new to Webservices and writing a test program .I am using the ECC 5.0 .I am calling a Webservice from R/3 .I am  trying to call this webservice  :[http://webservices.daehosting.com/services/isbnservice.wso?WSDL].
    I am getting the following exception
    {<?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <SYSTEMFAULT href="#o68" />
      </asx:values>
    - <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
    - <cls:CX_AI_SYSTEM_FAULT id="o68">
    - <CX_ROOT>
      <TEXTID>F63AFF63DBE4BB4786A7F52CC4167145</TEXTID>
      <PREVIOUS href="#o55" />
      <KERNEL_ERRID />
    - <INTERNAL_SOURCE_POS>
      <PROGID>191</PROGID>
      <CONTID>558</CONTID>
      </INTERNAL_SOURCE_POS>
      </CX_ROOT>
      <CX_STATIC_CHECK />
    - <CX_AI_SYSTEM_FAULT>
      <CODECONTEXT>Local</CODECONTEXT>
      <CODE>ERROR_WEBSERVICE_RUNTIME_INIT</CODE>
      <ERRORTEXT>Error when instantiating WebService runtime (Error when initializing SOAP client application )</ERRORTEXT>
      <LANGUAGE />
      </CX_AI_SYSTEM_FAULT>
      </cls:CX_AI_SYSTEM_FAULT>
    - <cls:CX_XMS_SYSERR_PROXY id="o55">
    - <CX_ROOT>
      <TEXTID>3F829CAF9A45633CE10000000A155117</TEXTID>
      <PREVIOUS />
      <KERNEL_ERRID />
    - <INTERNAL_SOURCE_POS>
      <PROGID>0</PROGID>
      <CONTID>0</CONTID>
      </INTERNAL_SOURCE_POS>
      </CX_ROOT>
      <CX_STATIC_CHECK />
    - <CX_XMS_SYSTEM_ERROR>
      <ID>ERROR_WEBSERVICE_RUNTIME_INIT</ID>
      <P1>Error when initializing SOAP client application</P1>
      <P2 />
      <P3 />
      <P4 />
      <INFO />
      <CATEGORY>XIProxy</CATEGORY>
      <AREA>ABAP</AREA>
      <RETRY>M</RETRY>
      </CX_XMS_SYSTEM_ERROR>
    - <CX_XMS_SYSERR_PROXY>
      <CO_AREA_ABAP>ABAP</CO_AREA_ABAP>
      </CX_XMS_SYSERR_PROXY>
      </cls:CX_XMS_SYSERR_PROXY>
      </asx:heap>
      </asx:abap>}
    This is what i have given in LPCONFIG Tcode
    LPCONFIG->General setting-> Call parameters->
    URL->http://webservices.daehosting.com/services/isbnservice.wso?WSDL
    Please help out what I am missing here
    Thanks
    Krishna

    I had the same error, while implementing a new client webservice.
    The Error ERROR_WEBSERVICE_RUNTIME_INIT was in my case solved by:
    1. regenerating the CL_SOAP_APPLICATION_CLIENT class.
    and
    2. deleting the LPCONFIG setting and creating a new one.
    Edwin.

  • How to get MessageTextInput Value when rendered property is set to false.

    Hi
    Is there any way wherein i can get the value of the data populated in the messageTextInput field which has it's rendered property set to false.When I use pagecontext.getParameter("textboxname"),i can fetch the value at the time of LOV event..but once my lov event is done and I hit the go button,pagecontext.getParameter("textboxname"), returns me null.
    Can anyone suggest me how can I track the value?
    Thanks
    Puja

    Setting rendered to false would make the bean not to be available in the HTML so you cannot do a getParameter on the bean.
    if you want to read a value that is like a hidden field, try using formValueBean instead.
    Thanks
    Tapash

Maybe you are looking for