ASCII & CHR Function

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



请使用浏览器的分享功能分享到微信等