Prob. Updating Date Field Coming from SQL Server into Oracle via OLE DB Command

  • I have a replication situation where several SSIS pkgs. routinely look at the contents of several SQL Server tables, compare those contents to identically-structured tables in Oracle, and try to handle making sure all of what's in the Oracle tables matches what's in the SQL Server tables exactly.

    I have an OLE DB Command transformation that, after a Conditional Split transformation, updates records in Oracle that are found to have one or more columns in Oracle that contain different data than the corresponding records in SQL Server.  The updates are causing the trailing ".000" portion of the date values from SQL Server to be stripped before the updates are applied to the column(s) in Oracle.  So, if I have an originating date of "2012-02-11 02:00:01.187" in SQL Server, the updates being made via the OLE DB Command transformation in SSIS are updating the values in Oracle to "2012-02-11 02:00:01.000", changing in this example the ".187" to ".000".  With this in mind, the update statement runs over and over each time the SSIS pkg. is executed, because of the droppage of whatever is in those 3 spots after the decimal automatically being converted to ".000".  It basically always thinks updates are needed.

    My update statement in the OLE DB Command transformation is as follows (stripped down within reference to other fields for purposes of this posting:

    Update SQLREPLICATION.As_CampaignItem

    Date_Created=?,

    Date_Modified=?,

    Date_Start=?,

    Date_End=?

    Where Campaign_Item_ID=?

    I've also tried:

    Update SQLREPLICATION.As_CampaignItem

    Date_Created=To_Date(?),

    Date_Modified=To_Date(?),

    Date_Start=To_Date(?),

    Date_End=To_Date(?)

    Where Campaign_Item_ID=?

    Regardless of which of the above UPDATE statements I use, the trailing digits of (example) ".187" or anything else digit-wise are always stripped and the date and time are updated in Oracle to ".000".

    Any thoughts / recommendations are greatly appreciated as I've been struggling with this for a while.

    Thank you!

  • Have you worked out exactly at what point the decimal values 'go missing'? Can you take SSIS out of the picture and replicate it purely in Oracle?

    Do you care about the decimals? If not, you could always strip them out in your source query (doesn't feel like a good solution, I agree).

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Everything date-wise with the 4 date columns I'm dealing with in SQL Server, which match-up with the exact-named 4 date columns in Oracle, are coming together in a Merge Join Transformation.  As those values come INTO the Merge Join Transformation, everything from both SQL Server and Oracle in terms of the date fields have values with the ".xxx" intact.

    As those records are coming OUT of the Merge Join Transformation heading into a Conditional Split Transformation, I can see that the SQL Server records and the Oracle records still have the full date/time characteristics (i.e. ".xxx") intact.

    So, I was wrong in my initial posting where I thought at some point in the process, the ".xxx" ending of the date/time data was being dropped.

    Nonetheless, when the update statement is executed in the OLE DB Command Transformation at the very end of some conditional splits that determine if a records needs inserted, updated, or deleted in Oracle, the UPDATE statement is still rounding-off any ".xxx" values to turn into ".000" during the update.

    Still have no idea how/why this is happening or how to resolve.  My insert statements are working perfectly and the original dates in the 4 date columns in SQL Server are being inserted into Oracle exactly correct with whatever is in the ".xxx" spot as far as the milliseconds part of the date/time are concerned.  It's just the UPDATE statement that's dropping whatever #s are in ".xxx" from the date columns and automatically making them insert as ".000".

    Thanks for your continued input or suggestions if you have any.  Really do appreciate it.

  • I know very little about Oracle, but I'm assuming that it has some sort of trace facility which would allow you to capture the actual UPDATE statements which are being issued.

    This would get you a step closer to identifying where the problem is happening: is the syntax somehow wrong for Oracle, or is the decimal part already missing at the time the UPDATE is issued.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply