Oracle 发生了什么事两个瓦查尔?

Oracle 发生了什么事两个瓦查尔?,oracle,plsql,oracle-sqldeveloper,Oracle,Plsql,Oracle Sqldeveloper,在我的Oracle db中,我注意到在执行操作时出现了一些奇怪的行为- SQL> select ascii('10000001') from dual; ASCII('10000001') ----------------- 49 SQL> select ascii('50000') from dual; ASCII('50000') -------------- 53 SQL> select 'true' from

在我的Oracle db中,我注意到在执行操作时出现了一些奇怪的行为-

SQL> select ascii('10000001') from dual;

ASCII('10000001')
-----------------
               49

SQL> select ascii('50000') from dual;

ASCII('50000')
--------------
            53

SQL> select 'true' from dual where ascii('10000001') < ascii('50000');

'TRU
----
true

1在5之前按顺序排序。这是一个字符串比较,其作用不同于数字比较。请参阅规则,其中解释了发生的情况。基本上,“1”是“小于“'5'作为字符集中的字符进行比较。如果有超过三十年的数据库实践强调为数据使用适当的数据类型的重要性就好了。这不仅在PL/SQL中是正确的,在SQL中也是正确的,我想,在所有区分字符串和数字的语言中也是如此。为什么不呢“1”是否小于“5”?
SQL> select ascii('10000001') from dual;

ASCII('10000001')
-----------------
               49

SQL> select ascii('50000') from dual;

ASCII('50000')
--------------
            53

SQL> select 'true' from dual where ascii('10000001') < ascii('50000');

'TRU
----
true