Vs 2012 2013 timestamp comparison

Hello

I'm new to PL/SQL, I found that was older that 2012 behave strange everything compared to a query, but after 2013, those that work very well, here are a few examples:

> > > example 1.-Code:

SELECT

EXTRACT (YEAR OF CAST ('01 - DEC -2012' TIMESTAMP)) JustTIMESTAMP

EXTRACT (YEAR OF CAST ('01 - JAN -2012' AS TIMESTAMP (6))) Timestamp6

EXTRACT (YEAR OF CAST ('01 - MAR -2013' AS TIMESTAMP (6))) with2013

FROM DUAL;

> > > > Results:

JUSTTIMESTAMP TIMESTAMP6 WITH2013

-----------------------------          --------------------------        ------------------------

2020                          2020                           2013

> > > example 2 - Code:

/ * [TEST TABLE] * /.

CREATE TABLE SP_Simultaion (TIMESTAMP (6) param1, param2 TIMESTAMP (6));

/ * [PROCEDURE] * /.

CREATE OR REPLACE PROCEDURE SP_Param_test)

IV_PROC_START_DATE IN TIMESTAMP DEFAULT NULL,

IV_PROC_END_DATE NULL DEFAULT TIMESTAMP)

AS

V_PROC_START_DATE TIMESTAMP (6): = IV_PROC_START_DATE;

V_PROC_END_DATE TIMESTAMP (6): = IV_PROC_END_DATE;

BEGIN

INSERT INTO SP_Simultaion (param1, param2)

VALUES (V_PROC_START_DATE, V_PROC_END_DATE);

END;

/*************** [ EXECUTE SP ] ***************/

EXECUTE SP_Param_test ('January 1, 2012","January 1, 2013"");

/ * [WHAT ARE THE RESULTS?] *** /

SELECT * from SP_Simultaion


> > > > Results:

PARAM1 PARAM2

------------------------------- -------------------------------

January 1st, 20 12.00.00.000000000 PM 1st January 13 12.00.00.000000000 AM

I know now that there are ways to avoid this by using the TRUNC function or date type ANSI or by simply using the DATE data type, and it looks to for older that 2012 it seems that the '12' is taken in time instead as part of the year and assuming that it is an expected behavior my questions are:

Why this happens in this type of data?

Why this only happens from 2012 and dates of order?

I thank very you much for your time and your answers.

Hello

d5779b73-53b0-4D29-A5be-73f3bb53bfcf wrote:

Hello

I'm new to PL/SQL, I found that was older that 2012 behave strange everything compared to a query, but after 2013, those that work very well, here are a few examples:

> Example 1.-Code:

SELECT

EXTRACT (YEAR OF CAST ('01 - DEC -2012' TIMESTAMP)) JustTIMESTAMP

EXTRACT (YEAR OF CAST ('01 - JAN -2012' AS TIMESTAMP (6))) Timestamp6

EXTRACT (YEAR OF CAST ('01 - MAR -2013' AS TIMESTAMP (6))) with2013

FROM DUAL;

> Results:

JUSTTIMESTAMP TIMESTAMP6 WITH2013

-----------------------------          --------------------------        ------------------------

2020                          2020                           2013

> Example 2 - Code:

/ * [TEST TABLE] * /.

CREATE TABLE SP_Simultaion (TIMESTAMP (6) param1, param2 TIMESTAMP (6));

/ * [PROCEDURE] * /.

CREATE OR REPLACE PROCEDURE SP_Param_test)

IV_PROC_START_DATE IN TIMESTAMP DEFAULT NULL,

IV_PROC_END_DATE NULL DEFAULT TIMESTAMP)

AS

V_PROC_START_DATE TIMESTAMP (6): = IV_PROC_START_DATE;

V_PROC_END_DATE TIMESTAMP (6): = IV_PROC_END_DATE;

BEGIN

INSERT INTO SP_Simultaion (param1, param2)

VALUES (V_PROC_START_DATE, V_PROC_END_DATE);

END;

/*************** [ EXECUTE SP ] ***************/

EXECUTE SP_Param_test ('January 1, 2012","January 1, 2013"");

/ * [WHAT ARE THE RESULTS?] *** /

SELECT * from SP_Simultaion


> Results:

PARAM1 PARAM2

------------------------------- -------------------------------

January 1st, 20 12.00.00.000000000 PM 1st January 13 12.00.00.000000000 AM

I know now that there are ways to avoid this by using the TRUNC function or date type ANSI or by simply using the DATE data type, and it looks to for older that 2012 it seems that the '12' is taken in time instead as part of the year and assuming that it is an expected behavior my questions are:

Why this happens in this type of data?

Why this only happens from 2012 and dates of order?

I thank very you much for your time and your answers.

If you really want to know why it behaves in this way:

When you try to convert a string to a TIMESTAMP (or DATE) without giving a format, Oracle tries to guess what format the string occurs in.  In your case, it's guessing that the format is something like ' MON DD YYYY hh. AM FF '.  He's waiting for you to spend a day, month, year, hour, minute, and second, but if you let the hour, minute, or second, it will use the smallest possible value as default value.  In addition, if you use a 2 digit year, it will be this century.

If the string is 1 January 2012', he realizes that you not give the minute or second, but it can interpreted as the year ' 20' and '12' as the time, and if he does.  '20' is a valid 2 digit year, and '12' is a valid format 'HH' time, which means that it returns 12:00 (i.e. noon) January 1, 2020.

If the string is 1 January 2013 ", he tries to see if"13"might be right, but 13" is not a valid time in the format 'HH', he guesses that you don't spend time at all.  He correctly interprets the day, month and year, and time, minute, and second by default for the first possible values: 12:00:00 AM (that is midnight).

There are rules on how Oracle makes its assumptions, but they are complicated and can be affected by session settings and the database.  Learning these rules would be a waste of time.  Rather than trying to understand how Oracle will guess what you mean, it is best not to guess at all.  Explicitly to say which format you want to use, by calling TO_DATE or TO_TIMESTAMP.

Tags: Database

Similar Questions

  • Are there updates on the Hp drivers website some of them are of 2012-2013 is where those of 2014

    Y at - it updates drivers Hp for my computer on the site Web of what some of them are of 2012-2013 where is 2014 more just so I know that I have the latest drivers for this year

    Thanks for giving detailed information.

    Yes you are right, HP stopped providing 2014 software for this model, but HP update drivers from time to time.

    Here is the link to download driver for your PC says: drivers

    The best option is INSTALL HP SUPPORT ASSISTANT: DOWNLOAD LINK

    This will help you to upgrade your PC from time to time.

  • What is the release date for Streets and Trips 2012/2013?

    What is the release date for Streets and Trips 2012/2013?

    Information about future product releases are usually announced through press conferences and other media.
    You can continue to monitor the Streets and Trips here site: http://www.microsoft.com/streets/en-us/default.aspx

  • I have adobe installed Muse v7.2 2012-2013, how can I update this program?

    I have adobe installed Muse v7.2 2012-2013, how can I update this program?

    If you have a valid subscription to Muse or CC; When you connect, it will work as a full version.

  • Where is the Instrument of IV parser in Multisim 2012/2013

    It is an instrument used in the academic version of Multisim called Analyzer IV.  I try to complete the simulation of circuits for the exercises in the laboratory before going to the lab, but cannot find this instrument in Multisim 2012 or 2013.

    Help, please!

    Hello

    Please contact us. The Analyzer IV is not included in the basis of Multisim full edition. It is only available in the Pro Power version and student and educational publishing. You can end a table comparison here.

    An alternative is to use analysis to sweep DC to draw the curves of current-voltage for the device. Here is a tutorial on how to use this analysis:

    Configuration of an analysis of scanning DC in Multisim

    I hope this helps.

  • Could not open VBAI 2012 / 2013 VBAI

    Hello

    I installed a VBAI 2012 (trial mode), but I can't open it

    He is stuck on the splashScreen

    Operating system: Win7 64 bit

    I also tried the Version of 2013, but some problems...

    Could you please help me

    This can happen when the mDNS OR the answering service does not work. Click Start, and then type 'Services '.

    In the window component Services, select Services (Local) in the left pane and make sure that the mDNS OR Autoresponder Service is started. If it is not running, double-click it, and click the Start button.

  • Install Exchange Server 2012 2013

    I have a company that has 7 users and I want to minimize the cost but also to keep everything internal. My question is this: Exchange 2013 are installed and are working effectively on Windows Server 2012 Standard domain controller? We want to keep everything on a single server. The server would function as a file server, domain controller and have email Exchange 2013.

    Note: Currently, we are running SBS 2003. We are not interested in the clouds or monthly subscriptions / annual.

    Thank you.

    Brett Foty

    Brett

    Server issues are beyond the scope of this forum.  Ask them in the corresponding section on TechNet

    http://social.technet.Microsoft.com/forums/en-us/home

  • Unable to connect to EMS on Exchange Server 2012 2013

    Hello

    As soon as I try to open the EMS on my server it tries to connect, but fails eventually. Below is the error indicating a PSSessionOpenFailed. He made several attempts until he says... "Unable to connect to an Exchange Server in the current site. Enter the FULL domain name server where you want to connect. : __ »

    It tries to connect to the server is the local server running the EMS on. Not sure why it cannot connect because it is on this server.

    VERBOSE: Server.domain.com connection.
    New-PSSession: [server.domain.com] connection to the server remote server.domain.com failed with the following
    error message: [ClientAccessServer=ALL-SVR1,BackEndServer=all-svr1.alliance.com,RequestId=550fd6eb-494c-4691-a1aa-291d
    af8dc91e, TimeStamp = 15/02/2016-15:52:55] [FailureCategory = coffee-SecureChannelFailure] for more information, see the
    about_Remote_Troubleshooting help topic.
    On line: 1 char: 1
    + New-PSSession - ConnectionURI "$connectionUri" - ConfigurationName Microsoft.Excha...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo: OpenError: (System.Manageme... RemoteRunspace: RemoteRunspace) [new-PSSession], PSRemotin
    gTransportException
    + FullyQualifiedErrorId: PSSessionOpenFailed,-2144108477

    Hello

    Your Question is beyond the scope of this community.

    Kindly forward your Question in the TechNet Forums of Exchange Server.

    https://social.technet.Microsoft.com/forums/Exchange/en-us/home?category=ExchangeServer

    TechNet Server forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • 2013 LabVIEW allows the user to return to the LabVIEW 2012 or 2011?

    Hi all

    I have LabVIEW 2013. I noticed that in LabVIEW measurement and Automation Explorer (MAX) under the LabVIEW Run-Time 2012 SP1 f2 software is listed. This somehow means I can return or switch between LabVIEW 2013 and 2012 without having to install/reinstall?

    The reason why I ask, is that I have several instrument drivers written for LabVIEW 2012 sp1 I want to use.

    This is probably a silly question, I know.

    On a related note, is it possible to tell if a driver written for an older version of LabVIEW will work in a new version of LabVIEW? Or you just have to play with the software?

    Thank you

    Oh, John

    Hi John,.

    More explicitly answer your main question - you can install multiple versions of LabVIEW in parallel (at the same time, on the same PC), however that one version of patch of each major version (for example, 2011, 2012, 2013) can be installed - you can not install 2012 and 2012 SP1 at the same time.

    The runtime that you noticed has probably been installed with another component that was built in this environment.

    As Dennis said, the big thing to keep in mind is that your screws will have to be upconvertis/resized when moving between versions.

    If your instrument driver is written in 2012 LabVIEW using the serial at low altitude of LabVIEW drivers, it will certainly work in 2013.  If you open the screw driver in 2013 and that you do not see workload issues, you should be good to go.  If pilots request DLL or another have external dependencies can be involved more work.

    Kind regards

  • Outlook Express is downloading more than 5000 messages 2011, 2012 and 2013

    It all started yesterday. My Inbox is downloading more of 5000 emails from 2011,2012,2013 that I removed from my computer. Whenever I try to send, it starts to download. In advance, I had ticked - clear the server every 5 days - which he obviously didn't. Now, I ticked the box beforehand to remove the server but these messages are still coming because they went from messages. Any help please?

    Moved from the community involvement Center

    Original title: Outlook Express

    To connect to your e-mail server's Web site and delete the messages there.
     
  • Emails from storage for the POP3 account folders 2012 WLM to Outlook 2013 POP3 only creates empty folders in the wrong email account

    NOTE: We have already been asked to come on this forum by Office 365/Outlook 2013 support, so don't tell people not that go back us!

    1. we are under W7 64-bit SP1, run WLM 2012 32-bit and 32-bit Outlook 2013 both installed on this system.

    2. we have a POP3 account set as DEFAULT account in WLM 2012 with old messages in different folders to storage.

    3. we have a POP3 account, which is defined as the DEFAULT account in Outlook 2013.  (But we also have an outlook.com account.)

    4. we try to migrate messages in the WLM 2012 storage folder named 'A book' in Outlook 2013.

    5. we followed the instructions in various other forums support and information pages of Microsoft as follows...

    6. with WLM 2012 and 2013 Outlook both running in WLM 2012 we:

    a. Select "File" (really just a down-arrow in the upper left corner)

    b. select «Export emails»

    c. then select "E-mail."

    d. Select "Microsoft Exchange", and then say 'OK' in the popup window that says that this move Outlook email, etc.

    e. then we click on option button "selected files".

    f. then we click on 'A book', which is a subfolder or storage of our WLM 2012 POP3 account folders.

    g so we say 'OK' and 'Finish '.

    7. for our tests, there are only 3 message in 'A record '.  After we get the message that the export was finished, there is no error message, so he seems to think that everything worked OK.

    8. However, the net result is that a folder named "Folder A" has been created in our outlook.com account (incorrect account; the account POP3 and NOT the default account) AND the folder is empty, containing no message at all.

    We also tried a different folder in WLM 2012 which has been directly added to the POP3 account, instead of lying in "Storage folders" of WLM, but the result was the same.

    There are thousands of e-mails concerned here.  We NEED to somehow get this export/import of working for us before we can migrate Office 365 WLM 2012 / 2013 Outlook.

    Remove the outlook.com e-mail account, and then confirm that MS Outlook works correctly with his pop e-mail account.

    Then in WLM run the export again process.

    Exported messages should appear in the MS Outlook Inbox

  • MATRIX Toolkit for LabVIEW 2012 for LEGO Mindstorms Installer?

    Hello

    Help, please

    Hi 40123157,

    MATRIX support is included in the competition MINDSTORMS Kit. Here you can find the box tool from last year: http://www.ni.com/download/labview-ftc-toolkit-2012-2013/4331/en/.

    An updated version of this tool for 2014-2015 aims to be released at the end of August.

  • installation LVRTE 2010 when already installed LVRTE 2012

    Hey,.

    I've lost track of installed on my PC.

    In my view, that an application of LV closes due to the installed LVRTE 2010.

    I installed LV 2012, 2013 & 2014

    I had also installed LVRTE 2012 (and obviously 6.1 (don't know where that came from, but I see in there OR programs installed in programs and features installed))

    Now I want to install LVRTE 2010 but it refuses with the popup: installed higher version

    should I just remove LVRTE 2012? and subsequently reinstall?

    Kind regards

    Koen.

    bad message! LVRTE installed 2010, 2012 not installed. LVRTE 2012 installation refuses install due to higher versions

    Sorry

  • Line break command missing in 2013 CVI

    I just changed to CVI 2012-2013.  I want to set up the command line cut (Ctrl-Y) in 2013, but as much as I know there is not cut command line available in the Options-> menu to change shortcut keys. Is avialable cut line in 2013?

    Tony G.

    I found the command of cutting line in the section "Miscallenaeous".  It works now.  Thank you!

    Tony G.

  • CVI 2013 SP1 - function calls repeated with pointer on a variable array parameter causes a shift of the index

    I have some functions will be pointers as parameter and CVI 2012 SP1, they work as before without problems but with CVI 2013 SP1 they are now incorrect.

    Here the description of what is happening - I found a cure, but a duty adopt the old code and I think it's clear that nobody don't "captures" all lines in a 'big old code' which are affected (maybe):

    I have functions

    'function_XYZ(int *p_paraArr) '.

    with 'p_paraArr' as pointers on a table (int).

    Suppose I have another function

    "fct_TOP (void)".

    where is a local array variable which is inizialized by

    "int TheArray [25] = {0};

    and inside of this "TOP"-function-body I call a function ".

    "function_XYZ (TheArray).

    There are no complains of the compiler (CVI 2012 or 2013) and the code works (but the CVI 2013 only once!).

    But if I put 'fct_TOP' loop I have a lag in the "TheArray' -memory.  (The loop surrounds the function "TOP"! "")

    This means that the result "TheArray" obtained from "function_XYZ (TheArray)" starts at index '1' not on the index '0' - as the first time that the function "function_XYZ (TheArray)" was performed. ".

    The solution is:

    I only replaced

    "function_XYZ (TheArray)" (<1>)

    by

    "function_XYZ (&(TheArray[0]))" (<2>)

    overall the program now works every time (in the whole loop)-the first time (in the loop).

    In the second version (<2>) everything is necessary to "work well":

    The '&' and parentheses "(...)", which contains the element that may be designated by the '& '.

    And I hope that you believe me: I've tested several times, it was only "little" change that solved the problem.

    So it seems that the ICB 2013 (SP1) is a kind of internal offset index by a repeated execution of the

    "function_XYZ (TheArray).

    but I don't know how or why but I see in debug mode by observing the expected against the values in the table received!

    At the first time the (implicit) internal index of 'TheArray' is '0', but the following times (during the execution of the loop) the internal index passes to '1' (seen in the debugger because that all the expected values were shiftet like that!).

    So there's an explicit index in the table ("function_XYZ (&(TheArray[0]))") necessary to make the first time of this clear code execution.

    There are some good improvements in 2013 CVI (SP1) and I like this environment more than the 2012 version - but:

    There are other "changes" also, in the compiler (or linker...?) that are more rigid than "in ancient times.

    The problem of this kind of error is always the 'old code '!

    It is expected of such behavior.

    The compiler/linker do not complain (a complaint would be good!) writing but he made this mistake (in a loop).

    By the way: my 'compilation Options' are set to 'Extended' (without change in the "..." ("- button - Options) and that all of the boxes, except the" OpenMP_support "-box are checked!"» So I think that I put the very rigid compiler - maybe there are some «...» ' - button - settings to get rid of this problem, but I have not found them/it.

    My request:

    -Check the stiffer compiler by the need of an explicit index

    - or switch to the 'old' behavior with "function_XYZ (TheArray)" always refers to implicit index '0' of the element "TheArray". "."

    Thank you for your messages, comments and suggestions.

    -As I wrote before - maybe it's the style of programming or error"self made"... maybe...
    .. But if I replace 'function_XYZ (TheArray)' by "function_XYZ (&(TheArray[0]))" and
    then it works... Why so and not, if bothe the same? ...

    But as long as I do not post sample code, nobody is going to accept - I accept it. So consider this post more as an allusion to the fact that of the LW/CVI 2012-2013 LW/CVI more changed than just the LW - GUI or certain features: the compiler changed its 'way to'... or almost.

    For this problem, I think that I will use the solution 'use no implicit and explicit pointers'.
    Who should be a good idea taking into account
        http://forums.NI.com/T5/LabWindows-CVI/fatal-run-time-error-dereference-of-out-of-bounds-pointer/TD-...

    mybe also only caused by wrong code... who knows... but for me it is a sufficient reason to act as I suggest above.

    Best regards,
    F.

Maybe you are looking for

  • Why GUI Skype get worse with each version?

    I'm constantly disappointed whenever I 'upgraded' Skype. MISTLETOE continues to get worse and worse. I want to just a very small list of contacts who will show me who is online. I don't want a large window that takes 1/4 of my office. Latest version,

  • The BootCamp drivers or manufacturer drivers?

    Hi guys. I want to install Windows 10 with the USB device in my end of 2012 i5 MBA 1, 7GHz/128SSD OWC/4 GB (El Capitan 10.11.3 beta) My question simply: what is best for the BootCamp performance of windows system drivers or the drivers from the manuf

  • How can I reformat a memory card?

    I still have a lot of images on my memory card after downloading photos to my computer. Apparently, I failed to check a box to "delete images after download. I want to erase all the images in my memory card.

  • replacing the battery for sleekbook 14-b017cl

    In December 2012, I bought a laptop named hp pavillion slekbook 14 model b017cl, now at start up I get a message about the failure of battery so I need to change the battery. I started looking for a replacement of the battery, but I found nothing Spo

  • My messenger account has been frozen due to the activity of spam

    original title: frustrated My messenger account has been frozen because of spam activity.  I have reset my password 3 times and still cannot access my orriginal account. What's wrong??