现在的位置: 首页 > 综合 > 正文

ASCII & CHR Function

2013年12月01日 ⁄ 综合 ⁄ 共 565字 ⁄ 字号 评论关闭

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);

抱歉!评论已关闭.