首页 > 代码库 > Oracle函数之chr

Oracle函数之chr


chr()函数将ASCII码转换为字符:字符 –》 ASCII码;
ascii()函数将字符转换为ASCII码:ASCII码 –》 字符;

在oracle中chr()函数和ascii()是一对反函数。
chr()函数示例:

SQL> select chr(65) from dual;

CHR(65)
-------
A

accii()函数示例:

SQL> select ascii(‘A‘) from dual;

ASCII(‘A‘)
----------
65


在做数据迁移时,我们用到了 chr(39) 表示单引号

---- 迁移便民终端中的 其它信息  合荣的表 ADMINISTRATORCONTRACT 与 运维的表    BIZ_ADMIN_CONTRACT 完全一致.--044_便民终端其它信息迁移BIZ_ADMIN_CONTRACTselect ----便民终端其它信息迁移  ||to_char(sysdate,yyyy-MM-dd HH24:mi:ss) from dual;select insert into BIZ_ADMIN_CONTRACT(  CONTRACT_NO           ,  NAME                  ,   ORGANIZATION          ,  BANKBOOK_NO           ,  WITHDRAW_LIMIT_SINGLE ,  TRANSFER_LIMIT_SINGLE ,  TRAN_MINIMUM_AMT      ,  DAILY_WITHDRAW_TIMES  ,  DAILY_WITHDRAW_AMT    ,  DAILY_TRANSFER_TIMES  ,  DAILY_TRANSFER_AMT    ,  DEPOSIT_LIMIT         ,  USE_DEFAULT_PARAM     ,  STATUS                ,  CDMAMOUNT             ,  DEPAMOUNT             ,  LASTJKDATE            ,  STRADMPERSONNUM       ,  LASTJKTIME)       values( ||  chr(39) ||CONTRACT_NO ||chr(39) ||,||  chr(39) ||NAME        ||chr(39) ||,||   chr(39) ||ORGANIZATION||chr(39) ||,||  chr(39) ||BANKBOOK_NO    ||chr(39) ||,||  WITHDRAW_LIMIT_SINGLE ||,||  TRANSFER_LIMIT_SINGLE ||,||  TRAN_MINIMUM_AMT      ||,||  DAILY_WITHDRAW_TIMES  ||,||  DAILY_WITHDRAW_AMT    ||,||  DAILY_TRANSFER_TIMES  ||,||  DAILY_TRANSFER_AMT    ||,||  DEPOSIT_LIMIT         ||,||  USE_DEFAULT_PARAM     ||,||  chr(39) ||STATUS      ||chr(39) ||,||  CDMAMOUNT             ||,||  DEPAMOUNT             ||,||  chr(39) ||LASTJKDATE  ||chr(39) ||,||  chr(39) ||STRADMPERSONNUM ||chr(39) ||,||  chr(39) ||LASTJKTIME    ||chr(39) ||  ); from xtcur.ADMINISTRATORCONTRACT t-- where t.CONTRACT_NO  in (‘&‘)     /* 按合同号迁移*/-- and t.NAME in (‘&‘)  /* 按客户姓名/-- and t.ORGANIZATION in (‘&‘) /* 按签约机构 */-- and t.BANKBOOK_NO in (‘&‘) /* 账号 */;

 

 

Oracle函数之chr