The cause is one of your to_date(...) or to_number(...) functions. Try to figure out the exact strings you're putting inside the parenthesis and compare them to the expected format string. Btw, I like to use the more explicit TO_DATE('08-08-2003', 'mm-dd-yyyy') where I can clearly see the expected format string...