Unable to insert date and time when using date datatype

Hi
I am hitting a bit of a problem when using the date datatype. When trying to save a row to the table where the field it throws an error ora 01830 and complains about converting the date format picture ends...etc. Now when I do the insert, I use the to_date function with the format of "dd-mon-yyyy hh24:mi:ss". Of course, when I remove the time element, everything is perfect.
Checking sysdate, I noticed that the time element wasn't be displayed, and I used alter session set nls_date_format to set the date and time I want to save to the table, which worked!
Then based on advice in a previous thread to permanently fix the problem, I used alter system set nls_date_format ="dd-mon-yyyy hh24:mi:ss" scope=spfile; This showed that it was altered, and I can see the setting in the em. In sqlplus, I shutdown the database, and restarted with startup mount; alter database open; and then selecting sysdate, it still shows the date as dd-mon-yy, and still no time! Checking the em, and looking up the nls_date_format the setting is still shown as "dd-mon-yyyy hh24:mi:ss".
So, my question is this - what am I doing wrong? Why can't save date and time using date in Oracle 11g?????
Thanks

user633278 wrote:
Hi
I am hitting a bit of a problem when using the date datatype. When trying to save a row to the table where the field it throws an error ora 01830 and complains about converting the date format picture ends...etc. Now when I do the insert, I use the to_date function with the format of "dd-mon-yyyy hh24:mi:ss". Of course, when I remove the time element, everything is perfect.
Checking sysdate, I noticed that the time element wasn't be displayed, and I used alter session set nls_date_format to set the date and time I want to save to the table, which worked!
Then based on advice in a previous thread to permanently fix the problem, I used alter system set nls_date_format ="dd-mon-yyyy hh24:mi:ss" scope=spfile; This showed that it was altered, and I can see the setting in the em. In sqlplus, I shutdown the database, and restarted with startup mount; alter database open; and then selecting sysdate, it still shows the date as dd-mon-yy, and still no time! Checking the em, and looking up the nls_date_format the setting is still shown as "dd-mon-yyyy hh24:mi:ss".
So, my question is this - what am I doing wrong? Why can't save date and time using date in Oracle 11g?????
ThanksYou most certainly can save the time. A DATE column, by definition stores date and time. What you describe is a presentation problem, and setting nls_date_format at the system as an init parm is the weakest of all settings as it is overridden by several other locations.
without seeing the exact sql that produced the error (not just your description of what you think you were doing) it is impossible to say for sure.
However, I'd suggest you read http://edstevensdba.wordpress.com/2011/04/07/nls_date_format/

Similar Messages

  • How to get the most current file based on date and time stamp using SSIS?

    Hello,
    Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
    Thanks
    thx regards dinesh vv

    hi simon
    i excuted this script it is giving error..
       Microsoft SQL Server Integration Services Script Task
       Write scripts using Microsoft Visual C# 2008.
       The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
        [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
            #region VSTA generated code
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            #endregion
            The execution engine calls this method when the task executes.
            To access the object model, use the Dts property. Connections, variables, events,
            and logging features are available as members of the Dts property as shown in the following examples.
            To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
            To post a log entry, call Dts.Log("This is my log text", 999, null);
            To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
            To use the connections collection use something like the following:
            ConnectionManager cm = Dts.Connections.Add("OLEDB");
            cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
            Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
            To open Help, press F1.
            public void Main()
                string file = Dts.Variables["User::FolderName"].Value.ToString();
                string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
                System.IO.FileInfo finf;
                DateTime currentDate = new DateTime();
                string lastFile = string.Empty;
                foreach (string f in files)
                    finf = new System.IO.FileInfo(f);
                    if (finf.CreationTime >= currentDate)
                        currentDate = finf.CreationTime;
                        lastFile = f;
                Dts.Variables["User::LastFile"].Value = lastFile;
                Dts.TaskResult = (int)ScriptResults.Success;
    thx regards dinesh vv

  • How to check the date and time when a material is blocked

    Hello,
       Please tell me how can i check the date and time when a material is blocked or unblocked.
    Regards,
    Priyanka

    Hi Pryianka,
    Are you speaking about blocked status of material master ('X-plant matl status' > MM03 > Basioc view 1; 'Plant-sp. matl status' > MM03 > MRP 1) or your problem is to find out the date when your material was booked into blocked state (stock category).
    If your problem is about mmr you can use the above mentioned MM04 (or MM03 > menu > Environment > Display changes).
    If your problem is to find out when your goods were posted to blocked stock you have to use MB51 + relevant movement types (e.g. 103, 344) + batch + etc. ()
    BR
    Csaba

  • Insert current date and time into Oracle date type field

    I have a JDBC current date and time insert into Oracle 9i that almost works. It submits the current date and a fixed time into the Oracle date type field. I am using Tomcat 6.0.20.
    For example if I insert the data at 7:24:04 PM on Feb 16, 2010 it will insert as: 16-Feb-2010 12:00:00 AM
    The date part works but the time always shows 12:00:00 AM no matter what date or time the data is inserted.
    Here is what I have for my JDBC inserts and I also tried something with DateFormat:
    PreparedStatement ps; Date mydate = new Date(new java.util.Date().getTime()); //insert statement here.... stmt.setDate(1,mydate);
    I also tried:
    PreparedStatement ps; java.sql.Timestamp mydate = new java.sql.Timestamp(new java.util.Date().getTime()); SimpleDateFormat fmt = new SimpleDateFormat(.... //insert statement here.... ps.setTimestamp(1,fmt.format(mydate));
    Both keep submitting the date into Oracle as 16-Feb-2010 12:00:00 AM
    Anyway to get the current date and time? For example if I insert the data at 7:24.04 pm today it should show as 16-Feb-2010 07:24.04 PM in Oracle.

    sportsMarkr wrote:
    Date mydate = new Date(new java.util.Date().getTime());Please see the javadocs for java.sql.Date and note the part that says "...to zero"
    [http://java.sun.com/javase/6/docs/api/java/sql/Date.html]
    If you want a date and time then use java.sql.Timestamp.

  • Inserting Date and Time into a date field

    Okay I am a bit of a Oracle newbie. I am trying to insert the following date and time into a date field and I don't know how to format the second part of the to_Date() function.
    Date/Time: 5/29/2003 7:58:45 PM
    Thanks,
    Branden

    I believe you would want
    to_date( '5/29/2003 7:58:45 PM', 'MM/DD/YYYY HH:MI:SS AM' )
    Note that tahiti.oracle.com has all of Oracle's documentation, including the very useful SQL & PL/SQL reference manuals, available for free.
    Justin

  • How do I Show date and time when I hover over clip like in iMovie

    How do I get FCPX 10.6 to show date and time when I hover over a clip? I can so it in I movie and as I move over my clips the date/time is shown. I need it for that specific point in the clip not just the record start time.

    I realize that my needs are outside of the normal editing workflow. I am a private investigator and last week I shot over 6 hours of surveillance video on a Sony video camera. Within this 6 hours of video there is at most 2 minutes of actual footage of my subject. So what I wanted to do was just import the parts of the clip I want, so I can avoid importing the whole 6 hours, and then add a text title of some sort that shows the date/time. My problem is that once I get this clip I have easy way of establising the TOD short of taking the clip capture time and then counting up using the SMTPE Timecode. In this regard iMovie makes it easier because I can just hover over the clip and see the TOD of that specific frame. iMovie on the other hand would force me to import the whole 6 hour video so i'm left moving between both programs which is less than ideal.

  • MRP run details(date and time when MRP was run)

    Hello,
    I need time stamps of all MRP/MPS run for a particular material. Please let me know relevant T.code/FM/BADI.

    Dear
    One more way to find this is using Transection Code AUT10.
    Here you can find not only Last MRP date but some other useful data also like user, date ,time and so many.
    Try it by using T.Code like MD01, MD02, MD40 etc.
    Or goto se16-SAP Table MDKP-Here you will get MRP run details
    Hope this helps
    Regards
    JH

  • Automatically displaying date and time in a date/time field on form initialize

    Good day all;
    I am trying to have the current date and time automatically be generated in a “date/time” field when the form is opened.
    I went through the forum and found an entry from Srini “ xfa.host.messageBox("" + Date());” . Of course this brought up a system message box with the date and time.
    I then tried “DateTimeField1.rawValue = (“”+date())… This also gave me a system message box with the date and time…
    Please let me know where I am going wrong
    Chomp

    Found the answer... And yes... in was in the "help" section... What can I say I was making it a lot more crazy than I needed to.
    You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.
    When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.
    1.
    In the Library palette, click the Standard category and drag a Date/Time Field object onto the form design.
    2.
    In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.
    3.
    Select the Runtime Property option.
    4.
    View the form in the Preview PDF tab.

  • Integration with Outlook - how to increment end date and time from start date/time

    Hi,
    I want to add a variable amount of time to an appointment start date and time in outlook, through vba in access.  Code below shows what I've done:
    ======================================
        Dim olApp As New Outlook.Application
        Dim olAppointment As AppointmentItem
        Dim myRequiredAttendee As Outlook.Recipient
        Set olAppointment = olApp.CreateItem(olAppointmentItem)    
        With olAppointment
            .Start = DateValue(strStartDate) + TimeValue(strStartTime)
            .Duration = intDuration
            .End = DateValue(strStartDate) + ????????
    =======================================
    What do I replace the ????? with so that it increments the start time by any duration I decide in minutes?  Using the duration doesn't seem to work and I also want to be able to have the appointment span a number of days, e.g. could start at 930am on
    Monday and end at 10am on Weds, but want to set the end time relative to the start time.
    Thanks,
    Chris.
    _________________________________________________________ Every day is a school day!

    I've tried that, but it throws out a datatype mismatch error :(
    It would be helpful if you posted the exact code you tried.  In my tests, setting teh .Duration property appears to work.  However, if you want to set the .End property to a specific number of minutes after the date/time of the .Start property,
    this works for me:
    With olAppointment
    .start = DateValue(strStartDate) + TimeValue(strStartTime)
    .End = .start + TimeSerial(0, intDuration, 0)
    End With
    Assuming, that is, that intDuration contains the number of minutes the appointment should last.
    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

  • Function that check if date and time between to dates and time

    hi
    is there any function that can check if date and time are between to dates and time ?
    thanks
    Ami

    You can check using IF condition.
    DATA : d1 TYPE datum, d2 TYPE datum, d3 TYPE datum.
    IF d1 BETWEEN d2 AND d3.
      d1 = d1 + 1.
    ENDIF.
    where d1, d2 and d3 are dates.
    Similarly you can check for Time and Timestamp.
    regards,
    Jinson

  • How can I have both date and time for a Date type variable?

    If I have a Date type variable: Date today=new Date(), Is it possible to also give the current time to "today" but still keep the type as Date?
    I mean , for exmaple I want to store this "today" to database as Date type, and the value in database is "2007-05-05 13:30:13". I do not want to use SimpleDateFormat to do that, because I want to use Date type not String. Is that possible? how to implement this?

    I'd say he means you should use Timestamp to store
    the time value, because that's what it's there for.
    Because java.sql.Date is defined not to store a
    time value.Correct. The OP should read the Javadoc for java.sql.Timestamp.

  • Is there a way to see an access history for my ipad mini? dates and times when it was accessed? not particularly a safari history, just when the pin code was last put in?

    Im worried that my ipad is being used without my knowledge, I am randomly losing whole conversations from my messages although they are still visible on my iphone. I wanted to see when my ipad was last accessed before i start accusing people of messing with it.

    I'm not aware of any setting or app that will do what you are looking for, but it possible you might find something in the app store.
    You should consider changing your pass code and possibly using complex rather than simple pass code. And keeping the device secure when not in your possession.

  • Firefox is displaying improper dates and times while using Google calendar, however they display correctly in Internet Explorer. Firefox has always worked right before, but not now.

    The Google calendar's information is accurately saved on our end on this sample page.

    Works for me on Linux.
    You can try http://kb.mozillazine.org/Time_and_time_zone_settings

  • Why does calendar keep changing dates and times on icloud

    My calendar keeps randomly changing dates and times when using icloud and it is doing my head in.
    Is there a simple way of rectifying this or do I have to get rid of icloud altogether (to save my sanity?)

    If this is an iCloud calendar, you might want to check your time zone and time zone support settings.  Go to icloud.com, sign into your iCloud account, click your name at the top and choose Account Settings, click Time Zone and be sure it shows the correct time zone and that you have selected a city near you.  Then open your calendar on icloud.com, click the gear-shaped icon on the bottom left and choose Preferences, click the Advanced tab and make sure you have not checked time zone support at the top.
    On your iOS devices, go to Settings>Mail,Contacts,Calendars>Time Zone Support (in the Calendars section) and make sure this is set to Off.

  • In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?

    In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?
    =IF(I127,NOW()," ")
    I127 equals a check box. The formula retuns a value of the current date and time when a check is placed in the box. How does one lock that date and time so that it cannot be changed?

    I don't think it is possible to lock in the date and time using a formula. You could put NOW() in a cell, copy, and Edit Paste Formula Results where you want the result.
    Or if you are "time stamping" a lot, you may find this Automator Service (Dropbox download) helpful. It puts a "Today" function (actually it should be named "Now" because it includes both date and time) in your Services menu like this:
    Just doubleclick the .workflow package to install it. You may have to click "download anyway" in System Preferences > Privacy & Security.
    If you want you can assign the service a keyboard shortcut in System Preferences here:
    SG

Maybe you are looking for

  • What is the use of tab - "ALLOCATION" in Asset master creation (AS01)?

    Hi experts... in AS01, there are certain tabs like General, Time-dependent, Allocation, origine, Dep area...etc... From these i am not understood the use of "Allocatio" tab. Please tell me when/why/where this can be useful? Regards: Dasu

  • Imposible to reset

    Hi! First of all, im spanish and my english is not so good. I will try to explain me possible the best. The ipod of my girlfriend I remain itself blocked and is impossible to resume it or to restore it. We have tried it all. It remained with the on s

  • Dynamic SQl Query Select

    Hello Colleague, I have a table that contains multiple entries of TABLE NAME. I need to query the databse table and check if certain entry exist in that table. I Loop over the table containing the tablenames and try a select : Loop at lt_key into ls_

  • How can I work around 1316 error that won't let me uninstall and then reinstall Elements 12

    Elements 12 stopped working and the shortcut no longer finds the executable file. There does not appear to be a repair function on the installation CD. As a result, I have tried unsuccessfully to uninstall the program using Windows 7 64 bit uninstall

  • Extend of vendor

    Hi This is lingaraj Can anyone please tell me How to extend More than one vendor at a one short from one purchase Organisation to another purchase organisation...