DBMS_SESSION. SET_CONTEXT sets / retrieves incorrect DATE values.

Hello

I created the script below:

-* Create the context XX_DATE_CONTEXT
CONTEXT to CREATE or REPLACE xx_date_context USING pkg_context;

Context created successfully.

-* Create package that sets the XX_DATE_CONTEXT
CREATE or REPLACE PACKAGE apps.xx_dtctxt_pkg
IS
FUNCTION xx_set_context (p_ctxt IN varchar2
p_date IN date)
RETURN number;

FUNCTION xx_get_context (p_ctxt IN varchar2)
Date of RETURN;
END;
/

CREATE or REPLACE PACKAGE apps.xx_dtctxt_pkg BODY
IS
p_context_name CONSTANT all_context.namespace%TYPE: = "XX_DATE_CONTEXT";

-* Create the function that defines the XX_DATE_CONTEXT using DBMS_SESSION. SET_CONTEXT
FUNCTION xx_set_context (p_ctxt IN varchar2
p_date IN date)
RETURN number
IS
BEGIN
DBMS_SESSION.set_Context (p_context_name
p_ctxt
p_date);
RETURN 1;
EXCEPTION
WHILE OTHERS
THEN
RETURN 0;
END xx_set_context;

-* Create the function that retrieves the value at the date of the XX_DATE_CONTEXT
FUNCTION xx_get_context (p_ctxt IN varchar2)
Date of RETURN
IS
BEGIN
RETURN SYS_CONTEXT (p_context_name
p_ctxt);
EXCEPTION
WHILE OTHERS
THEN
dbms_output.put_line (SQLERRM);
-RETURN NULL;
END xx_get_context;
-EXCEPTION
-WHILE OTHERS
-THEN
-DBMS_OUTPUT. PUT_LINE (SQLERRM);

END;
/

Package & body created successfully.

Now I set the context as below:

/ * Formatted on 29-Oct-2009 11:00:09 (v5.114.809.3010 PS5) * /.
DECLARE
x VARCHAR2 (10);
date of y;
"date of TDT: = 1 January 1951";
number of z;
BEGIN
x : =
xx_dtctxt_pkg.xx_set_context ("PARAM_DATE"
TDT);
y: = xx_dtctxt_pkg.xx_get_context ("PARAM_DATE");
dbms_output.put_line (TO_CHAR (y)
'DD-MON-RRRR"));
dbms_output.put_line (TO_CHAR (y)
'DD-MON-YYYY"));
z: = SYSDATE - y;
dbms_output.put_line (z);
END;
/

The retrieved value is 1 January 2051 ' and not of 1951, which is the value passed.
Please advice on how to extract the exact value for this case.

Thank you
L. Julie

convert your date to a string in the appropriate format, something like

to_char (sysdate, 'dd-mm-yyyy')

Tags: Database

Similar Questions

  • Retrieve a data value in a field

    Hi guys

    I created a page that should read some values of a customer in the table

    On this page, I have a question (screen only now, later as hidden) configured with the P7_CUSTOM_ID id
    This field should get value from the database with a query like

    Select ID from vbv_customers where email =: APP_USER




    When I opened the details of item P7_CUSOM_ID a navigate to the SOURCE, I have configured the following.

    Source: only when current value in the session is null
    Source type: SQL query
    Source type: select id from msm_klanten where email =: APP_USER.



    When I run the page, the field is always empty.


    How can I find the ID of the customer in this area?

    1. are you sure the e-mail and: APP_USER are both in the same case and are the same values? If this is not the case, use:

    upper(email) = upper(:APP_USER)
    

    This will kill your index finger on the email, but at least you'll be able to tell if there is a problem of value.

    2. of the source used, use 'replacement always '.

    3. have you any other process on the page the could be the value of the element of compensation?

    See you soon,.
    Janet Tyson

  • How to interpret the data cache setting and the current value of data cache?

    How to interpret the data cache setting and the current value of data cache? We found that even, we configure a larger data cache in Essbase 2 GB for example, the current value of the data cache is always much lower. Does that indicate an activities of data at very low recovery or something else?

    Thanks in advance!

    Hello

    When a block is requested, Essbase searches the data for the block cache. If Essbase is the block in the cache, it is immediately accessible. If the block is not found in the cache, Essbase in the index for the appropriate block number and then uses the index of the block entry to retrieve from the data on the disk file. Retrieve a block requested in the data cache is faster and therefore improves performance.

    So as you say that its current value is much lower then % is very low, that a requested block is in the cache of Essbase data.

    Hope that respond you to the.

    Atul K

  • How can I set a time stamp for the setCreationDate(Date value)?

    Hi all

    My underlying database column has a DATE data type that needs of the data and the time stamp. When you use the following code to set a date for setCreationDate(Date value) the date is set, but there is no timestamp.

    Here is the code:

    protected void create (AttributeList attributeList) {}

    Super.Create (AttributeList);

    Begin

    Date currentDate = new Date();

    DATE creationDate = currentDate.getCurrentDate ();

    setCreationDate ((Date) creationDate);

    End

    }

    Can't wait to hear.

    James

    java.sql.Timestamp timeStamp = new java.sql.Timestamp (System.currentTimeMillis ());

    dateTime oracle.jbo.domain.Date = new oracle.jbo.domain.Date (timeStamp);

  • idac6 of the incorrect data returned by winrm commands

    Issue commands to idrac winrm returns incorrect data or no data. There are a lot of servers that do not work, but about 5 x the amount which work very well on the same FW revisions. The question is about R610 and R410.

    Pretty standard FW level:
    IDRAC = 1.90
    LCC = 1.5.5.27

    The following command returns incorrect data that are constant in all those who are broken. To start the model isn't T710 and the ChassisServiceTag does not match the ServiceTag as it does normally if the system is not a blade. All incorrect data displays the model under T710 and the ChassisServiceTag as JDTR5L1. They also all what they have only one dimm installed. BIOS version is incorrect, but also seems to be incorrect on which ones work.

    NOTE: Replace with the IP or name of the idrac. Change password if it is not the default value of calvin.

    WinRM g http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_SystemView?__cimnamespace=root/dcim+InstanceID=System.Embedded.1 - u: root - p: calvin - r: https: / //wsman - SkipCNcheck - SkipCAcheck-encoding: utf - 8 - has: basic

    Data:

    AssetTag
    BIOSReleaseDate = 03/05/2010
    BIOSVersionString = 2.1.3
    BaseBoardChassisSlot = NA
    BladeGeometry = 4
    ChassisName = the main system chassis
    ChassisServiceTag = JDTR5L1
    ChassisSystemHeight = 5
    ExpressServiceCode = DELETED
    FQDD = System.Embedded.1
    Host name = DELETED
    InstanceID = System.Embedded.1
    LastSystemInventoryTime = unknown
    LastUpdateTime = 20100310170819.000000 + 000
    LifecycleControllerVersion = 1.5.5
    Manufacturer is Dell Inc.
    MaxCPUSockets = 2
    MaxDIMMSlots = 18
    MaxPCIeSlots = 1
    MemoryOperationMode = OptimizerMode
    Model = PowerEdge T710
    PlatformGUID = 314e4d4f-c0b4-3280-4610-00324c4c4544
    PopulatedCPUSockets = 0
    PopulatedDIMMSlots = 1
    PopulatedPCIeSlots = 0
    PowerState = 2
    PrimaryStatus = 1
    ServiceTag = DELETED
    SysMemErrorMethodology = 6
    SysMemFailOverState = NotInUse
    SysMemLocation = 3
    SysMemPrimaryStatus = 0
    SysMemTotalSize = 512
    SystemID = 652
    SystemRevision = 1

    I tried "racadm racreset hard" without success. Next step is to be able to drain. After that it's default settings. After it's LC repair which seems to solve many questions randomly.

    I opened a case of dell already but would like to know if anyone ever seen this problem?

    Thanks for any help.

    This allows to CSIOR fixed the problem.

    Does anyone know a simple way to update the setting on 11 gen/idrac6 without doing it manually during a restart?

    I looked at using the following and do not see anything:
    omconfig
    racadm
    syscfg

    I think that this can be done through management to idrac, but the process seems mean.

  • Using 'New data value reference' in a loop

    Hi all

    I just read on the data value references (DVR?) and I'm trying to use them with overall functional (see table).

    I don't think that I'm just doing.  The final goal is a producer/consumer nickname.  My concern is that I don't feel the implementation of the new primitive data value reference and re-stuffing the result in the FGV, should occur in each loop.

    Of course I could "spread" data with a single gueue element (where the queue of new data would take place each loop).  I just thought that I would play with them.

    Beavercreek wrote:

    I think that we defend the same point, but I can't seem to understand why this does not work the way I expected.  I discovered the DVR (and queues) as a pointer, simply a way that the other vi can know where the data is located.  The data that we are after is here.  So, why Ch1 does not work in the data_reader.vi?

    If we can get Ch1 to work data_reader without re-creating and re-writing of the reference in the FGV each pole (what does Ch2), we find no more what is wrong with my vI or I'm going to learn something that is still beyond me.  I hope to hit me in the head this afternoon still

    You are missing a fundamental idea: the function you call creates a reference that points to a specific value. To actually interact with this value (read/write), you need to use the structure of the International preliminary examination. At this time what you are creating a single reference for ch1 (which do you nothing with) and creation of multiple references to ch2 (where at each iteration that you replace the reference in the FGV, so you basically lose the old reference), so instead of having two DVRs, you really N + 1 DVR (where N is the number of iterations of the loop runs).

    For your code works the way you want, you only need to create two digital video recorders (probably before the loop), then bring them inside the loop and use the structure of the International preliminary examination with nodes in R/W DVR to set the value in the DVR.

    For example:

    Other problems with the code, but this deal the DVR issue.

  • Incorrect date during installation

    I bought Vista today and did a clean install. Then I installed the motherboard, logitech drivers video card drivers on and printer drivers. I then installed Kaspersky internet protection. After the installation of Kaspersky, I needed to update the definitions. Meanwhile, I noticed that the date said July 1, 2010. Today's date is June 30. I went to change the current time and date in order to correct the fault and Kaspersky came say the incorrect posting date after I put the date to June 30. I reset the date back to July 1 and the problem disappeared.

    What I need to know, is how can I fix this error without having to reinstall everything all over again? If I change the date to July 1, 2010 July 2 it will affect all other facilities that see the posting date? Seriously, I don't want to sit around another 2 hours reinstalling everything. But still I'll wait hours or days for a response. Difference being I can do other things then tend to a computer configuration ;)  Will disable updates on everything and setting the correct date to midnight work (I'm a night owl)?

    If you don't have the correct Date, it can affect things can, including Windows updates, Live Racing broadcasts. etc.

    As it happened after the installation of Kaspersky, you could contact their support and ask them why.

    Normally, if you simply replace the correct date, it does not affect things.

    Right click on the date in the notification area on bottom right and change

    See you soon.

    Mick Murphy - Microsoft partner

  • How to set the current date in the datetimepicker in qml?

    Hello

    Can I know how to set the current date in the DateTimePicker in QML?

     DateTimePicker {
                        id: datePicker
                        mode: DateTimePickerMode.Date
                        title: "Date"
                        value: "2013-11-20"
                        maximum: "2013-11-20"
                    }
    
    Container {
        DateTimePicker {
            id: picker5
            title: "DateTimeQml"
            mode: DateTimePickerMode.DateTime
            value: { new Date(); }
        }
    }
    
  • Incorrect date on the screen of TP phone sessions

    Hello

    As you know, the sessions of TP phone screen shows forthcoming meetings. the clock shows properly at the top left, as 18:19 07/17/11, but in the second line, the date of scheduled meeting is not today, as 23/05/06

    Any help will be much approciated

    Fix... While the phone may have the right date because he can pick up the date / actual time of the SIP messages it receives, the planned meeting information gets fed to the screen of the phone of the codec. So, if there is no set of NTP server, the codec may have an incorrect date and it will show the meetings for that day, even if the phone clock shows the correct date.

  • My calendar shows an incorrect date.

    Original title: Question calendar

    My calendar shows an incorrect date.  How can I fix?

    The date is the problem in your area?

    The steps for setting the date are on this page:

    http://Windows.Microsoft.com/en-us/Windows-8/clock-out-of-sync

    If this isn't what you mean, please post more information.

    Kate

  • retrieve the datasource value

    In a Web app "Listing", I've created several fields with the type of field "datasource". After making the data on an Internet site the output in html code changes. The value is retrieved from the field in the data source, but also the 'href' link - code. It interferes with my markup schema.org.

    Is there a way only to retrieve the datasource value?

    Thanks in advance for any help.

    Krgds Carla@home

    I finally found the answer in the documentation on: http://docs.businesscatalyst.com/reference/liquid/filters.html

    How to remove HTML code

    that is, if you want to remove the

    -tag, you use the command:

    {{ '

    My paragraph

    ' | strip_html }}

    the above code removes the HTML of the string and outputs 'my paragraph.

  • Set up the date and time on a HP Officejet Pro 8600 more

    How do you set up the date and time on an Officejet Pro 8600 more?

    I'm going to fax setting, and then there is a dispute of options:

    Resolutions

    Lighter or darker

    Send the original documents by fax

    Set as new default values

    Fax set up but nothing on the date and time.

    Please e-mail me step by step instructions

    Note: The user manual has no instructions for this date and time to set up

    Thank you

    Go to the printer settings. Go to your preferences. There is an option DATE and HOUR.

  • Incorrect date by function


    Hi all

    Below, I have created a function to return the date value of a fixed-length characher database input file. But if a space has been passed to this function he gave erroneous results.

    
    

    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    Logged in as crm

    SQL >
    SQL > date of RETURN of FUNCTION to CREATE or REPLACE date_check (value_in VARCHAR2) IS
    2
    3 test_date DATE;
    4
    5 BEGIN
    6
    7 test_date: = to_date (value_in, 'DDMMYYYY');
    8
    9 test_date of RETURN;
    10
    11 END date_check;
    12.

    Feature created

    SQL > select to_date (date_check ('04 04201'), 'dd-mon-yyyy') of double;

    TO_DATE (DATE_CHECK('0404201'),
    ------------------------------
    04/04/01

    SQL >

    The input file has a space in the 8 characters sets the file format.

    Can you please tell me how to fix this feature. ?

    Thank you

    Hello

    Z. Sid_ wrote:

    Hi Frank,.

    Space could not be there forever and if he can come to any post in 8 character then how to deal with this situation?

    You can use REPLACE or TRANSLATE to get rid of the spaces, if they exist.  I have modified my first answer with an example.

  • Set the default Date Format in 4.2 jQuery Mobile Smartphone

    Hi guys,.

    on 'normal' office interfaces, you can set a default date format in the globalization settings. Currently I am working on an application JQM and I noticed that the same settings I have to format date in other applications, take effect.

    I read today in the 4.2 notes version, that somehow this question was a bit buggy. If this problem is corrected? I would firstly like JJ German date format. "" MR. YYYY "; (such that it works in office applications). How can I do? This entry is saved in the global settings.

    But whenever I want to put a date-picker-merchandise in this format, it changes again in 'YYYY-MM-DD' after registration. And I don't really want to enter a dml processing conversion function writing now.

    Thanks for all tips, best looks,.
    Tobi

    Hey Tobi,

    the item type of ' date picker (HTML5) "corresponds to the type of input HTML5 = 'date', which requires that the internal format of the value date must always be YYYY-MM-DD, but he returned to the browser to display the date in the format of the local operating system parameter. The browser of the iOS for example displays the date in the format of my setting local language/country.
    See also http://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format

    To make a long story short, it is not possible to specify the display format for dates selectors, because this is not supported by the HTML5 specification.

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Oracle how to assign a date value in a parameter declaration

    How can I assign a date value to a parameter declaration in SQL?

    Here are my existing script.

    CURRENT SITUATION:

    select distinct as summary ' iCash EAD error Summary", count (*).
    AAA. BKS_ICASH_EAD_ERRORS
    where creation_date > to_date (' 26/05/12 08:50 "," mm/dd/yy HH24 ')
    Summary group


    I want to assign the date I'm looking for a parameter and use the setting in my query.


    OBJECTIVE:

    DECLARE
    pCreateDate DATE;

    exec: pCreateDate: = 5/26/12-08:50 ';

    select distinct as summary ' iCash EAD error Summary", count (*).
    AAA. BKS_ICASH_EAD_ERRORS
    where creation_date > to_date (: pCreateDate, "mm/dd/yy HH24 '")
    Summary group

    Hello

    In SQL * Plus, you can do this:

    VARIABLE     pcreatdate     VARCHAR2 (20)
    EXEC           :pcreatedate := '5/26/12 8:50';
    
    SELECT    summary          AS "iCash EAD Error Summary"
    ,       COUNT (*)          AS "Total Count"
    FROM        aaa.bks_icash_ead_errors
    WHERE       creation_date  > TO_DATE (:pcreatedate, 'MM/DD/RRRR HH24:MI')
    GROUP BY  summary
    ;
    

    'GROUP BY summary' means that you will get a line of output for each distinct value of the summary. He has no need of SELECT DISTINCT since the GROUP BY is already ensuring that the lines are separate.

    There is no variable binding DATE in SQL * Plus, so you must use a VARCHAR2.
    If you do something similar in PL/SQL, you can use a DATE variable. Make sure that you do not call TO_DATE on something that is already a DATE.

    Published by: Frank Kulash on June 26, 2012 14:01

Maybe you are looking for

  • iTunes syncs all my photos with iPad Pro

    Hi community, this is my first post here have just acquired a new iPad Pro 9.7 "256GB and I'm a bit of a learning curve.  At the age of 67, the old brain is not as sharp as it used to be LOL, but I'm already in love of what can do this little beauty

  • simple save 320 GB external hard drive

    I have a HP simple save 320 GB external hard drive.  When I plug it into my lap top, I can hear it loading, then at the bottom right corner I see the icon that allows you to remove the material safely; However I don't see the device anywhere.  Can so

  • RV082, Dual Wan, VPN + protocol bindings

    Hi all I have this kind of Setup and I can't figure out how to think this router. My Installer uses Dual Wan load balancing mode. I only need one VPN tunnel. High availability is my concern. Site 1 has fiber and Cable Site 2A cable and FTTN Each ISP

  • x201i problem with adding devices and connecting with them via Bluetooth

    I have a new computer x201i laptop Windows 7, Bluetooth is installed and running, the icon is on but I can't communicate with external devices like mobile phones. The system concludes that they are, but does not allow the exchange of files. I get the

  • Settings, photo App

    Just bought a new computer and all by familiar me with the apps I did something to the camera app when I click on it says I need to change my settings in the application. How do I do that?