0

I'm facing an issue with an update statement that worked earlier in Oracle 9i but now it does not update any rows in Oracle 11G. Here is the statement that i'm using.

update account  
set 
  days_to_validate = validated_date - val_requested_Date 
where 
  validated_date >= val_requested_date

The validated_date and val_requested_date are both date fields in the format: dd-mmm-yyyy (18-Mar-2015). This was working earlier in Oracle 9i before we did an upgrade.

Pls advice on how we can fix this.

Thanks Prashanth

4
  • 1
    are they date fields? Or are they varchar fields storing dates? Commented Apr 8, 2015 at 11:56
  • Please provide definition of account table, e.g. create table statement. Commented Apr 8, 2015 at 12:07
  • Hello Guys, I was able to fix this. I tried including the "to_date" function and it worked in Oracle 11G. Here is the change i made to the query. Commented Apr 8, 2015 at 12:43
  • Missed the query in my earlier comment: update account set days_to_validate=to_date(validated_date)-to_date(val_requested_Date) where to_Date(validated_date)>= to_date(val_requested_date) Commented Apr 8, 2015 at 12:44

1 Answer 1

1

I was able to fix this. I tried including the "to_date" function and it worked in Oracle 11G. Here is the change i made to the query.

update account
    set days_to_validate = to_date(validated_date) - to_date(val_requested_Date)
  where to_Date(validated_date) >= to_date(val_requested_date) 
Sign up to request clarification or add additional context in comments.

1 Comment

To be completely safe you should give the format in the TO_DATE() function as well - e.g., TO_DATE(validated_date, 'dd-mmm-yyyy')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.