Oracle 10g 中的 NVARCHAR2 方程问题
环境:
Oracle 版本:版本 10.2.0.1.0 服务器:Windows XP
oracle 语言:
select userenv('language') from dual;
结果:
CHINESE_CHINA.AL32UTF8
表结构:
PARTY_ID NVARCHAR2(50)
PARTY_TYPE NVARCHAR2(50)
表中的数据:
PARTY_ID | PARTY_TYPE
---------+-----------
BEST | C
WILL | C
SQL1:
SELECT * FROM cc_party
WHERE party_type = 'C'
结果:
无
SQL1:
SELECT * FROM cc_party
WHERE party_type = 'C' or party_type = 'C'
结果:
PARTY_ID | PARTY_TYPE
---------+-----------
BEST | C
WILL | C
问题:
为什么我无法通过 party_type = 'C'
(SQL1) 选择数据? NVARCHAR2 有什么特别之处吗?
如果我将 where 子句更新为 party_type = 'C' 或 party_type = 'C'
(SQL2),我可以获得结果。这让我很困惑。我想知道为什么当我添加 or 子句时会出现结果?
Env:
Oracle version: Release 10.2.0.1.0
Server: Windows XP
Language in oracle:
select userenv('language') from dual;
Result:
CHINESE_CHINA.AL32UTF8
Table structure:
PARTY_ID NVARCHAR2(50)
PARTY_TYPE NVARCHAR2(50)
Data in the table:
PARTY_ID | PARTY_TYPE
---------+-----------
BEST | C
WILL | C
SQL1:
SELECT * FROM cc_party
WHERE party_type = 'C'
Result:
nothing
SQL1:
SELECT * FROM cc_party
WHERE party_type = 'C' or party_type = 'C'
Result:
PARTY_ID | PARTY_TYPE
---------+-----------
BEST | C
WILL | C
Question:
Why I can not select data by party_type = 'C'
(SQL1) ? Is there some special things about NVARCHAR2 ?
If I update the where clause to party_type = 'C' or party_type = 'C'
(SQL2), I can get the result. It makes me confused. I want to know why the result come out when I added or clause.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试并告诉我结果
SELECT * FROM cc_party WHERE trim(party_type) = 'C'
Try,and tell me the result
SELECT * FROM cc_party WHERE trim(party_type) = 'C'