甲骨文 |变量2 |数相等 |输出不同

Oracle | Varchar2 | Number Equality | Different output

我在 Oracle 中有一个 table,比方说 Table1:

Column - ticketNo - NOT NULL VARCHAR2(10)

现在当我 运行 不同的查询时,我得到不同的输出,尽管记录存在。

select * 
from Table1 
where ticketNo = '0900000106'; -- Fetches the record

select * 
from Table1 
where ticketNo = '0810087720'; -- Fetches the record

select * 
from Table1 
where ticketNo = '0050001104'; -- Fetches the record

select * 
from Table1 
where ticketNo = '3180000013'; -- Fetches the record


select * 
from Table1 
where ticketNo = '900000100'; --  Does not fetch the record

select * 
from Table1 
where ticketNo = '5889770';    -- Fetches the record

select * 
from Table1 
where ticketNo = 0900000106; -- Fetches the record

select * from Table1 where ticketNo = 0810087720; -- Fetches the record
select * from Table1 where ticketNo = 0050001104; -- Fetches the record
select * from Table1 where ticketNo = 3180000013; -- Fetches the record

select * from Table1 where ticketNo = 900000100; --  Fetches the record
select * from Table1 where ticketNo = 5889770;    -- Fetches the record

我无法理解为什么对于少数记录 '' 比较失败。

我正在使用 SQL 开发者查询以上。

甲骨文 IDE 17.4.1.054.0712

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

例如,当您比较 ticketNo = 900000106 时,ticketNo 的字符值 '0900000106' 被转换为数字 900000106 并匹配正确的相等项。