ORACLE invalid number

The problem of invalid numbers is generally that when we report an error or assign a value when converting a string to a number in a sql statement, we force the number 1 to be converted to a value that does not match two types (a numeric type and a
non-numeric type). Assignment operation;
2. Compare two values ​​that do not match the type (for example, "=");
3. The value in the to_number function is not a number, for example, to_number('1.5 days') is wrong, to_number( '100') is normal
-- DISCHRG_LIMIT is of type varchar and DISCHRG_PROMPT is of type number
select to_number(DISCHRG_LIMIT) from contract_ship
If we convert the string to a number, the lookup is no problem, but if we sort it, then report Invalid number error [Error] Execution (1: 8): ORA-01722: invalid number
select 1 from contract_ship where to_number(DISCHRG_LIMIT)>DISCHRG_PROMPT

おすすめ

転載: blog.csdn.net/fromVillageCoolBoy/article/details/89641595