此需求可以利用 length 與 lengthb 兩個函數, 來幫我們實現此需求,
只要 length 值 <> lengthb 值, 就可能有中文字,
此方式雖不能 100% 準確, 但多少可滿足.
程式碼
select length('abc中國')
from dual;
-- 結果: 5 碼
--------------------------
select lengthb('abc中國')
from dual;
-- 結果: 9 碼 (UTF8 一個中文字 3 碼)
--------------------------
select 1
from dual
where length('abc中國') = lengthb('abc中國');
-- 結果: 0 row (表示字串中有中文字)
--------------------------
select 1
from dual
where length('abc') = lengthb('abc');
-- 結果: 1 row (表示字串中無中文字)
更準確的判斷中文方式, 請參考我這篇最新的文章囉.
