Oracle 中的隐式数据类型转换

Implicit Data Type Conversion in Oracle

这个说法是真的吗?

字符值和数字值之间的比较总是隐式地将字符值转换为数字数据类型。

没错。

The manual几乎包含相同的句子

Implicit Data Conversion
...
...

  • When comparing a character value with a numeric value, Oracle converts the character data to a numeric value.

是的,这是真的,如果您有一个包含混合字符和数字的 VARCHAR2 列并且您试图 select 其中一个数字,这可能会有点烦人。看这个例子:

create table t1 ( c1 varchar2(10));
insert into t1 values ('x');
insert into t1 values ('1');

select * from t1 where c1 = 1;

http://sqlfiddle.com/#!4/3d880/1