Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql Oracle | Varchar2 |数字相等|不同输出_Sql_Oracle_Select_Varchar2 - Fatal编程技术网

Sql Oracle | Varchar2 |数字相等|不同输出

Sql Oracle | Varchar2 |数字相等|不同输出,sql,oracle,select,varchar2,Sql,Oracle,Select,Varchar2,我在Oracle中有一个表,比如说表1: Column - ticketNo - NOT NULL VARCHAR2(10) 现在,当我运行不同的查询时,我会得到不同的输出,尽管记录是存在的 select * from Table1 where ticketNo = '0900000106'; -- Fetches the record select * from Table1 where ticketNo = '0810087720'; -- Fetches the record

我在Oracle中有一个表,比如说
表1

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
我无法理解为什么对少数记录的比较失败

我正在使用SQLDeveloper来查询上面的内容

Oracle IDE 17.4.1.054.0712


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

那么实际值是多少<代码>'0900000106'或
'900000106'
?很明显,这与
INT
conversion@HoneyBadger实际值为0900000100。此外,如果列是字符串,则带引号的版本是正确的。不管有没有吵架,那就很清楚了,不是吗<代码>900000106=900000106为真,
'0900000100'='900000100'
为真not@HoneyBadger是的,谢谢你指点