Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

ORACLE-023: annoying ora-01722 invalid number

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I used to write sql statements for a period of time, but I always reported ora-01722 inexplicably.

It's frustrating for this error prompt, especially for a complex sql statement, because most of the time you don't know what's going on.

Through the summary of each encounter, in fact, it is not so difficult to solve, the main reasons are:

1. Assign values of two types that do not match (one numeric type, one non-numeric type, the same below)

2. Compare two values with mismatched types (for example, "=")

3. The value in the to_number function is non-numeric, for example, to_number ('a') is definitely not good, and to_number ('12306') is normal.

To avoid these problems, it is necessary to seriously deal with different types of problems when writing sql statements.

For example, if you want to compare, both use to_number cast (to_number (field a) = to_number (field b))

Or convert it to a string type at the same time (field a | |'= field b | |'', all concatenate an empty string to make it a string type).

When using the to_number function in a statement, make sure that the value must be in numeric format, or write exception handling.

When we encounter this error prompt, we start with the fields of all the numeric types used and check them one by one to solve the problem.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report