Date datatype in source and destinattion. But format is different in source

Hi
I have a proc that loads data from source table to destination table.
In the source table, I see the date is stored as yyyy/mm/dd. When i try to load from this source to destination, I get the following error:
SQLCODE -1861 SQLERRM ORA 01861 Literal string does not match the format string.Is there a way that I load from source to destination irrespective of the way date format used in source?
I cant do :
insert into destinationtable(datecol)
(select date1 from sourcetable)I get the above mentioned error.
Any help???

Hi,
So date1 is a VARCHAR2 column, that's supposed to represent a date in 'yyyy/mm/dd' format, but sometimes contains text that is not in that format: is that the problem?
Here's a package function I've used for similar problems:
--          **   t o _ d t   **
--          to_dt attempts to convert in_txt to a DATE using in_fmt_1_txt.
--          If that fails, it tries again, using in_fmt_2_txt.
--          If that fails, it tries again, using in_fmt_3_txt, and so on.
--          As soon as one conversion works, the function returns the DATE,
--          and the remaining formats are not tried.
--          If all the formats given fail, then NULL is returned.
FUNCTION     to_dt
(     in_txt          VARCHAR2                    -- string to be converted
,     in_fmt_1_txt     VARCHAR2     DEFAULT     'DD-Mon-YYYY'     -- 1st format to try
,     in_fmt_2_txt     VARCHAR2     DEFAULT NULL          -- 2nd format to try
,     in_fmt_3_txt     VARCHAR2     DEFAULT NULL          -- 3rd format to try
,     in_fmt_4_txt     VARCHAR2     DEFAULT NULL          -- 4th format to try
,     in_fmt_5_txt     VARCHAR2     DEFAULT NULL          -- 5th format to try
RETURN     DATE
DETERMINISTIC
IS
     fmt_cnt          PLS_INTEGER     := 5;          -- Number of in_fmt_ arguments
     fmt_num          PLS_INTEGER     := 1;          -- Number of argument being tried
     return_dt     DATE           := NULL;     -- To be returned
BEGIN
     WHILE     return_dt     IS NULL
     AND     fmt_num      <= fmt_cnt
     LOOP
          BEGIN     -- Block to trap conversion errors
               return_dt := TO_DATE ( in_txt
                                   , CASE     fmt_num
                                          WHEN  1     THEN  in_fmt_1_txt
                                          WHEN  2     THEN  in_fmt_2_txt
                                          WHEN  3     THEN  in_fmt_3_txt
                                          WHEN  4     THEN  in_fmt_4_txt
                                          WHEN  5     THEN  in_fmt_5_txt
                                END
          EXCEPTION
               WHEN OTHERS
               THEN
                    NULL;
          END;     -- Block to trap conversion errors
          fmt_num := fmt_num + 1;
     END LOOP;
     RETURN     return_dt;
END     to_dt
;The best solution, though, is to clean up the source table.
Identify the rows where date1 is not in 'yyyy/mm/dd' format.
If you can figure out what the correct data should be, UPDATE to that value.
If you can't figure out what the correct data should be, UPDATE to NULL.

Similar Messages

  • I am up to date with Mozilla, Adobe and Shockwave but am unable to print PDF files or view animations in programmes

    I use a teaching resource called Studyladder.co.nz. It uses animations for teaching programmes and activites. On my new computer, with up to date versions of Firefox and Adobe I am unable to get the animations to work. Also I am unable to print PDF files.

    Hi Hilarym-
    Here are two articles with information about printing issues:
    * [[Firefox prints incorrectly]]
    * [http://kb.mozillazine.org/Problems_printing_web_pages Problems printing web pages]
    Here is another article regarding your problem with animations:
    * [[Images or animations do not show]]
    Hope that helps!

  • How can you use the same Apple ID for music and apps but have a different iCloud

    Collectively in my family we have 1 iPhone 2 ipod(4th gen) and 3 iPad mini's and we like to buy music and apps through the same Apple ID so that we can all share it but we also have a problem about the iCloud.
    My son has one iPod and one iPad and he would like his contacts and messages to be shared between HIS two devices but he would also like all of the pictures taken in the family to be shared
    The same for my daughter and for me.
    Is there a way of selecting which devices share what????
    Thanks a lot
    Acwills

    You could and should set up different iCloud accounts in "Settings > iCloud", so that every user has its own email account, calendars, reminders, notes, storage for backups and app data (files etc.), by the way everyone could also use his own account for iMessage (Settings > Messages > Send & Receive) and FaceTime (Settings > FaceTime) so that you all could write and call each other.
    Next the Apple ID for music, apps and other media: You all could just set up the ssame Apple ID in "Settings > iTunes & App Stores" for all your media purchases like songs, movies, apps etc.

  • Share Photo Stream and Contacts but backup to different iCloud accounts

    I have researched this question a bit and found remotely similar questions but none exactly the same (feel free to point out an answer that answers this already).
    Is there a way to use a joint iCloud account between my wife and I (so Photostream and contacts are synced), but have the phones backup (to iCloud) to two different accounts?
    At the moment, the "main" iCloud account on both iPhones shares the photostream and contacts - which is great. I've also installed another iCloud account (on each phone, i.e. three iCloud accounts in total) with the calendars shared between each new account and to solve the problem with Siri automatically switching who we are (see https://discussions.apple.com/thread/3411497?start=0&tstart=0 for this problem, which I have fixed). Ideally, I would like each phone to backup to these (new) accounts due to space restrictions, not the shared iCloud account.
    Currently, it seems, I can only backup to whichever account the Photostream comes from - is this correct? If not, how do I get around this?
    (I consider iTunes as a completely separate entity but FYI, iTunes on both iPhones uses a shared account - one that is completely separate from all the iCloud accounts mentioned above).

    To migrate to a new account and keep your data and photos, start by saving any photo stream photos that you want to keep to your camera roll (unless already there) by opening your my photo stream album, tapping Select, tapping the photos, tap the share icon (box with upward facing arrow), then tapping Save to Camera Roll.  If you are syncing notes with iCloud that you want to keep, you'll need to open each of your notes and email them to yourself so you can later copy and paste the text into new notes created in your new account.  Then go to Settings>iCloud, tap Delete Account (which only deletes it from this device, not from iCloud), provide the password to turn off Find My iDevice and choose Keep on My iDevice when prompted.  Then sign back in with a different Apple ID to create your new account and choose Merge to upload your data.
    if you are signing back into the same account, just with a revised ID you should choose Delete from My iDevice when prompted as your data will still be in your account and will download back to your device when you sign back in with the revised ID.  You do still need to save your photo stream photos to your camera roll before deleting the existing account.

  • I want to use Icloud on my iphone, ipad, desktop and labtop, but 2 have different account names- can I merge my apple ids or find a way to connect them all?

    Hello Hello-
    I want to connect all of my computers together but over the years I must have created 2 accounts.  Is there a way to merge accounts or sign in in all of them the under the same account. 

    If by "merge accounts" you mean merge iTunes accounts (using your Apple ID), then the answer is no.  If you bought songs, apps, etc. using both accounts over time, then your are stuck.  You need to choose one account for your iTunes.

  • 1 appointment, correct in cal and touch but 1 hour different on nano?

    Hi there. I set up without too many problems my google calender to sync with my iPod touch....and then introduced my partners nano. Ok so we were pleased until
    my partner asked why I was working early on Friday.... Transpires that ALL entries have 1hours difference on our two iPods?
    The computer and both iPods are all on the same time zone, all show the correct time and all appointments are correct in google cal and on our own iPods - the appts only change on the other's iPod.
    Any ideas? Thanks

    Hello mysterick and welcome to the BlackBerry Support Community Forums.
    Have you checked your Yahoo Calendar settings to make sure it has the correct Time Zone? 
    Check under your Yahoo Calendar Options then in the General Preferences.
    Thanks and have a great day!
    -HMthePirate
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Date datatype in Sybase to Oracle

    We are in the process of migrating Sybase Adaptive Server 12.5.2 to Oracle 10g. However, we came across a "Date" datatype in Sybase and am not able to map it to corresponding Oracle 'Date" datatype.
    In OMWB, Tools -> Options-> DataType Mappings, I am not able to see the "Date" in source data types.
    Any insights please.
    Diwakar

    Diwakar,
    I have filed a bug 4579859 on this issue.
    This is not a trivial problem with the datatype options, a table with the date datatype will fail to map.
    Do you have many tables with this datatype, is it practical to convert these tables to datatypes recognised by the workbench (such as datatime or even varchar)?
    Regards,
    Turloch
    Oracle Migration Workbench Team

  • Data source was activated and replicated but not showing up in RSA7.

    Hello,
    Data source was activated and replicated but not showing up in RSA7.  At what point does the data source appear in the Delta Queue?
    Thanks

    Hi,
    for LO,LIS,generic,FI data sources, delta records come from delta queue.
    if u run the INIT in BW whether it may be success or not delta queue will be maintained in RSA7. and u can check the records in RSA7 or smq2.
    when the init request goes to R/3 then it will maintains delta queue in RSA7.
    assign points if it helps,
    thanks,
    pavan.

  • I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    click and hold on one cell, then drag to select the range, then release, then type the delete key.  Only inlude cells in the range you do not want to keey the contents of the cell.  You can remove one-off cells by holding the command key and clicking cells to add or remove as needed.
    You can download the Numbers users guide here:
    http://support.apple.com/manuals/#productivitysoftware

  • Problem with Date - Text File Source and Oracle Target

    Hi All,
    I have a source data (text file) with date column in the format of 'MM/DD/YYYY'. My target is oracle. I am using the LKM FILE TO SQL and IKM SQL Control Append. When i execute this interface, i am getting an error as
    7000 : null : com.sunopsis.jdbc.driver.file.b.i
    com.sunopsis.jdbc.driver.file.b.i
    at com.sunopsis.jdbc.driver.file.b.f.getColumnClassName(f.java)
    at the Load Data step.
    How to load date columns from text file to oracle tables? Please help me in resolving this...
    Thanks in Advance,
    Ram Mohan T

    The worst solution is to define for your text file the date as a string and then to rebuild your date type in Oracle.
    something like
    convert(Substr(myfield,4,2)||Substr(myfield,1,2)||Substr(myfield,7,4) ,'MMDDYYYY')
    this is maybe the worst solution but it should work.
    Regards
    Brice

  • SQL Developer: Right-click format doesn't work right with DATE datatype

    Hi All!
    Currently I'm using version SQL Developer Version 3.1.05.
    Got a question regarding the 'auto-format' of syntax whenever writing in the code editor.
    If you take this snippet of code and drop it into a worksheet, then highlight it, right click the mouse, then select "format" it's like it fails to add the proper spacing when it runs into the DATE datatype. I looked all through the : preferences > database > sql formatter > oracle formatting > edit and couldn't find anything regarding the formatting with date types.
    Am I looking in the wrong area?? Is this a known bug? Having trouble searching for this exact issue too. I LOVE the format feature, but I hate having to go to each date type and manually spacing it out to make everything look 'clean'. I'm picky I guess :P I can live with it but figured I'd ask.
    type TEMP_REC
    IS
    record
    ORG_CODE VARCHAR2(15),
    PROJECT VARCHAR2(15),
    WBS VARCHAR2(30),
    SERIAL_NO VARCHAR2(30),
    QTY_ORDERED NUMBER,
    QTY_SCRAPPED NUMBER,
    QTY_COMPLETE NUMBER,
    BOM_ID NUMBER,
    REQUEST_DATE DATE,
    CREATE_DATE DATE,
    REL_DATE DATE,
    START_DATE DATE,
    NEED_DATE DATE,
    DUE_DATE DATE,
    COMPLETE_DATE DATE,
    CREATED_BY VARCHAR2(30),
    MODIFIED_BY VARCHAR2(30),
    MODIFY_DATE DATE,
    EST_HOURS NUMBER(6,2),
    ACT_HOURS NUMBER(6,2),
    BAD_COMMENTS VARCHAR2(1000) );

    Hello,
    I put 3.1.07 as you'd suggested. Seems the problem is still occuring for me... probably a user preference though ;)
    Open a new worksheet and drop this in, highlight everything, right-click and choose "format". All the keywords (varchar2, number, etc) should align on themselves making it look nice. I have mine set up to line-break after a comma. (I can't get it to format properly as I type it here onto the forums, so added a bunch of spaces to try to mimic it in this view)
    type TEMP_REC
    IS
    record
    LEAD_TIME NUMBER(5,0),
    SCRAP_PERCENT NUMBER,
    CREATED_BY VARCHAR2(30),
    MODIFIED_BY VARCHAR2(30),
    OPER_SEQ VARCHAR2(6),
    REF_NO VARCHAR2(2000),
    COMMENTS VARCHAR2(2000),
    BOM_FLAGS VARCHAR2(100),
    BOM_ATTR1 VARCHAR2(30),
    BOM_ATTR2 VARCHAR2(30),
    BOM_ATTR3 VARCHAR2(30),
    BOM_AMT1 NUMBER,
    BOM_AMT2 NUMBER,
    BAD_COMMENTS VARCHAR2(1000) );
    Now, let's add another field in there, but this time a date/timestamp datatype. If you format it like this you will see that the keywords sort of 'reset' their position after it encounters a date/timestamp datatype. The date type doesn't align properly with the others.
    type TEMP_REC
    IS
    record
    LEAD_TIME NUMBER(5,0),
    SCRAP_PERCENT NUMBER,
    CREATED_BY VARCHAR2(30),
    MODIFIED_BY VARCHAR2(30),
    OPER_SEQ VARCHAR2(6),
    REF_NO VARCHAR2(2000),
    test DATE,
    COMMENTS VARCHAR2(2000),
    BOM_FLAGS VARCHAR2(100),
    BOM_ATTR1 VARCHAR2(30),
    BOM_ATTR2 VARCHAR2(30),
    BOM_ATTR3 VARCHAR2(30),
    BOM_AMT1 NUMBER,
    BOM_AMT2 NUMBER,
    BAD_COMMENTS VARCHAR2(1000) );
    Might post a picture next time if that still isn't clear, though I konw folks are leary against clicking links to see screenshots. Might you know what I'm doing wrong here?

  • Data Recovery from Partitioned and formatted Bit Locker Encrypted Drive

    Recently because of some issues in windows 7 installation from windows 8 installed OS. it was giving as the disc is dynamic windows can not be installed on it. so at last after struggling hard no other solution i partitioned and formatted my whole
    drive so all data gone included the drive which was encrypted by bit lockers.
    For recovery i used many software such as ontrack easy recover, get data back, recovery my files professional edition but still i couldnt able to recover my data from that drive. then i found some suggestion Using CMD to decrypt my data first 
    http://technet.microsoft.com/en-us/library/ee523219(WS.10).aspx
    where it shows it successfully decrypt my data at that moment my drives were in RAW format excluding on which windows is installed and then in CMD i check Chdsk which also shows no problem found. but now problem is still i coudnt able to recover
    my data then i format the drive D and again tried to recover data using above software after decryption still no result. 
    Now i need assistance how i can recover my encrypted drive as it was partitioned and also formatted but decrypted also as i have its recovery key too. thanks

    Hi ,
    I am afraid that we cannot get the data back if the drive has been formatted even if use the
    BitLocker Repair Tool.
    You’d better contact your local data recovery center to try to get data back.
    Tracy Cai
    TechNet Community Support

  • 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/

  • Working with multiple users and computers, but shared data

    Sorry if this is posted in a poor place, I'm not sure where the best place is. This is sort of a general questions.
    For a long time, my wife and I have had either one computer, or two machines but one has definitely been just a terminal. We've basically set up all of our data to be one one primary machine, and if we want to view/edit that data we have to use that machine.
    We just got a new MacBook Pro and I would like to be able to use two machines as equals. Sadly, this idea of multiple computers, with two users and some shared data is really giving me difficulty. I was wondering if anyone has any suggestions on how to best manage things like:
    Synchronizing portions of our contact list (We share about 50% of the combined library -- we don't have to share all though).
    How to manage iPhoto so that we can each have access to the photos. As an added difficulty (or maybe this is easier?) my Wife just wants to have access to the pictures for viewing and sharing on Facebook/Picassa/etc. I am the only one who wants to edit, correct and cull our library. That said, I always edit when I first put the data on the machine, and almost never again; so it would be fine to have one (or both accounts) set up as view only for the iPhoto data.
    How to manage iTunes so that we can each have access to the music. As a super awesome bonus, it would be great if we could have three libraries: His, Hers and Shared. Maybe as much as 30% of our music library is similar, the rest just gets in the way.
    What is the best solution people have found for calendars? (I'm thinking two separate calendars, and we each subscribe to each others iCal feed)
    Mail.app and bookmark synching is not really a problem for us.
    Two extra points:
    * One machine is portable, and the other isn't. Ideally, when the laptop is out of the house, both machines should still have reasonable access to the shared data. That is: Just dumping things in the shared folder won't work because when the laptop is out of the house we will be disconnected from the source data.
    * We just got a second iPhone. This means that both of us will be taking photos/video separately and trying to synch back to the master data store.
    * Basically, I'm trying to minimize data duplication as much as possible, and just synchronize the systems to each other.
    Thanks a ton in advance. If anyone has any suggestions at all, I would love to hear them. Including "This is in the wrong forum, go ask here instead..."

    So you have a desktop Mac and a laptop Mac, right? Two user accounts (and a third admin account) on each computer, right?
    I profess that I haven't tried this, but here is how I would approach your problem:
    Sharing Music and Photos between multiple user accounts on the same computer: 
    See if http://forums.macrumors.com/showthread.php?t=194992 and http://forums.macrumors.com/showthread.php?t=510993 provide any useful information to assist you in this endeavor.
    Sharing across multiple computers:
    Turn on file sharing on the Desktop (System Preferences > Sharing). Now you can mount the Desktop as an external drive on the laptop's Desktop. Copy the music and photo folders across. Will take awhile to do the first time. Then, for future use, get a copy of the donationware CarbonCopyCloner or equivalent. You can use CCC to selectively sync specific folders from one computer to the other. There may be a hassle with digital copyright issues on music and movies, though.
    Calendars:
    As you have suggested yourself, publishing yours and subscribing to hers is probably the best way to do it, on the same computer. Across computers, syncing with CCC or equivalent would probably be the way to go.

  • How can I use my external hard drive on both pc and mac, but also being able to use it to back up my mac data?

    I want to be able to transfer some of my files from my laptop to my macbook, but not all of them. I have a NTFS external hard drive and I have heard about reformatting it so that it can read/write across both systems, but can I still use this hard drive to back up the data on my macbook? If I can, how should I go about reformatting the hard drive?

    FORMAT TYPES
    FAT32 (File Allocation Table)
    Read/Write FAT32 from both native Windows and native Mac OS X.
    Maximum file size: 4GB.
    Maximum volume size: 2TB
    You can use this format if you share the drive between Mac OS X and Windows computers and have no files larger than 4GB.
    NTFS (Windows NT File System)
    Read/Write NTFS from native Windows.
    Read only NTFS from native Mac OS X
    To Read/Write/Format NTFS from Mac OS X, here are some alternatives:
    For Mac OS X 10.4 or later (32 or 64-bit), install Paragon (approx $20) (Best Choice for Lion)
    Native NTFS support can be enabled in Snow Leopard and Lion, but is not advisable, due to instability.
    AirPort Extreme (802.11n) and Time Capsule do not support NTFS
    Maximum file size: 16 TB
    Maximum volume size: 256TB
    You can use this format if you routinely share a drive with multiple Windows systems.
    HFS+ ((((MAC FORMAT)))) (Hierarchical File System, a.k.a. Mac OS Extended (Journaled) Don't use case-sensitive)
    Read/Write HFS+ from native Mac OS X
    Required for Time Machine or Carbon Copy Cloner or SuperDuper! backups of Mac internal hard drive.
    To Read HFS+ (but not Write) from Windows, Install HFSExplorer
    Maximum file size: 8EiB
    Maximum volume size: 8EiB
    You can use this format if you only use the drive with Mac OS X, or use it for backups of your Mac OS X internal drive, or if you only share it with one Windows PC (with MacDrive installed on the PC)
    EXFAT (FAT64)
    Supported in Mac OS X only in 10.6.5 or later.
    Not all Windows versions support exFAT. 
    exFAT (Extended File Allocation Table)
    AirPort Extreme (802.11n) and Time Capsule do not support exFAT
    Maximum file size: 16 EiB
    Maximum volume size: 64 ZiB
    You can use this format if it is supported by all computers with which you intend to share the drive.  See "disadvantages" for details.

Maybe you are looking for