ORACLE Delete query not working properly

  • I created a simple delete query that I assigned to a variable. I then used the variable as the source for the ORACLE delete query. When the query runs it deletes ALL of the records instead of only those that meet the criteria expressed in the delete query. If I run the same query from TOAD it works just fine. The query I am running is:

    Delete TABLENAME where Program = 'ABC' and End_Of_Period >= '28-Mar-2010'

    I build the query dynamically in a script task substituting in the program and the end of period date. What do I need to do get the DELETE query to work correctly?

    I just noticed another anomoly. Even though I pass in '28-Mar-2010', when I go into query builder it is changing it to '3/28/2010' which generates a ORA-01843: not a valid month error.

  • Figured it out. I had to explicitly declare the value as a date: TO_DATE('3/28/2010', 'MM/DD/YYYY')

  • Thanks for posting your solution. Others with a similar problem may be able to benefit from it.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

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

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