ASCII & CHR Function

来源:互联网 发布:mysql当前时间减一小时 编辑:程序博客网 时间:2024/05/21 19:55
The ASCII function returns the NUMBER code that represents the specified character.ASCII( single_character )

SELECT ASCII('A') FROM dual;
Output:A


The CHR function is the opposite of the ascii function. It returns the character based on the NUMBER code.
CHR( number_code )

SELECT CHR(9) FROM dual;
Output:TAB

记录这个的原因是因为,遇到一客户问题,发现系统里的lot number中有空格似的字符,但是使用下边的query,又查不出来
select * from mtl_lot_numbers where lot_number<> ltrim(rtrim(lot_number));
最后才发现是因为lot number的中是有Tab字符(trim不会处理tab字符)。可以使用下边的query来查询确认
select *
from apps.mtl_lot_numbers
WHERE organization_id=207
and inventory_item_id=606
and lot_number like 'S00001%'|| CHR(9);



原创粉丝点击