Once a period of time to write SQL statements, always inexplicably reported ora-01722.
For this error, especially for a complex SQL statement, is very depressed, because many times do not know.
Through each encounter summary, in fact, is not so difficult to solve, the main reason is:
1, for two types of mismatch (a numeric type, a non-numeric type, the same value) to perform the assignment operation;
2, two types do not match the value of the comparison operation (for example, "=");
3, the value of the To_number function, not the number, for example, To_number (' a ') is certainly not, to_number (' 12306 ') is normal.
To avoid these problems, it is necessary to deal with different types of problems when writing SQL statements.
For example, if you want to compare, both with To_number cast (to_number (field a) = To_number (field b)),
or convert to a string type at the same time (field a| | "= Field b| |", all connecting an empty string to make it into a string type).
When using the To_number function in a statement, ensure that the value must be in the number format, or write the exception handling.
When we come across this error, we'll start by checking the fields of all the numeric types we use, and then we'll solve the problem.
ORACLE-023: annoying ora-01722 Invalid numbers