oracle varchar到数字

use*_*511 29 oracle varchar numbers

如何将oracle varchar值转换为数字

例如

table - exception
exception_value 555 where exception_value is a varchar type
Run Code Online (Sandbox Code Playgroud)

我想测试exception_value列的值

select * from exception where exception_value = 105 instead of
select * from exception where exception_value = '105'
Run Code Online (Sandbox Code Playgroud)

Fer*_*anB 39

您必须使用TO_NUMBER函数:

select * from exception where exception_value = to_number('105')
Run Code Online (Sandbox Code Playgroud)


Ton*_*ews 12

由于列的类型为VARCHAR,因此应将输入参数转换为字符串,而不是将列值转换为数字:

select * from exception where exception_value = to_char(105);
Run Code Online (Sandbox Code Playgroud)


dpb*_*ley 1

从异常中选择 to_number(exception_value),其中 to_number(exception_value) = 105