cast_to_raw oracle,在oracle中使用utl_raw.cast_to_varchar2,将raw转换为varchar…

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

字符集问题 你的PL/SQL DEV的字符集不对

UTL_RAW.CAST_TO_VARCHAR2 converts a raw value into a value of data type VARCHAR2 with the same number of data bytes. The result is treated as if it were composed of single 8-bit bytes, not characters. Multibyte character boundaries are ignored. The data is not modified in any way, it is only changed to data type VARCHAR2.

Syntax result := UTL_RAW.CAST_TO_VARCHAR2(input);

where:

resultis the output value of the function. It is data type VARCHAR2. The value is null if input is null.inputis the input value of datatype RAW to convert to datatype VARCHAR2.

==》正常的例子

问问maclean

SQL> select UTL_RAW.CAST_TO_RAW('问问maclean') from dual;

UTL_RAW.CAST_TO_RAW('问问MACLEAN')--------------------------------------------------------------------------------E997AEE997AE6D61636C65616E

SQL> select utl_raw.cast_to_varchar2('E997AEE997AE6D61636C65616E') as maclean from dual;

MACLEAN--------------------------------------------------------------------------------问问maclean

==》 字符集不对的例子

C:\Users\xiangbli>set nls_lang=american_america.US7ASCII

C:\Users\xiangbli>sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Fri Aug 23 21:32:27 2013

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select utl_raw.cast_to_varchar2('E997AEE997AE6D61636C65616E') as maclean from dual;

MACLEAN--------------------------------------------------------------------------------??maclean

==》出现了乱码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值