Oracle-ORA-01722 Invalid Number Error

Source: Internet
Author: User

Suddenly one day, good system error: ORA-01722 Invalid Number

Environment: oracle9 + JDBC access to the database. It was okay before. This error was suddenly found.

Later referred to: http://davidyu720.itpub.net/post/31716/291191 to know the reason

1.CodeThe following SQL statement is executed:

Select MDN from tablename where MDN = 13800000000

The mdn field in the tablename table is a varchar2 () type field. Because of the implicit type conversion function of Oracle fields

The preceding SQL statement is usually feasible. When Oracle parses this condition during a query, the to_number (MDN)

Make a comparison with where MDN = 13812345678. If the MDN field contains all numbers

Therefore, this statement will never be reported (there may be efficiency problems), but some people mistakenly add it to the MDN.

Several letters: 133aa000000. If the preceding statement still exists and the table does not contain 13800000000 of the user data,

When the query scans for 133aa000000, to_number (MDN) reports an error in the ORA-01722 Invalid Number

2. Therefore, it is best to write SQL statements properly:

Select MDN from tablename where MDN = '201312'

No problems!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.