ITPub博客

首页 > 数据库 > Oracle > ASCII & CHR Function

ASCII & CHR Function

原创 Oracle 作者:pan_tian 时间:2014-07-02 13:56:00 0 删除 编辑
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);



<!-- Baidu Button BEGIN -->

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26687597/viewspace-1204287/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Prompt & Accept in sqlplus
下一篇: How to use Chrome to access Oracle Applications
请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2012-02-18

最新文章