How can I store bytes in Oracle Varchar2, and have ASCII treated as text

巧了我就是萌 提交于 2020-01-16 09:09:11

问题


How can I have bytes stored in a Varchar2, and have it treated "normally" as text when it is ASCII for example? (Like in queries).

If not possible, where is the limitation?

I know the column is defined with a character sets, so if it is ANSI for example, what kind of 1-byte values can I not put there? Are there "better" solutions than ANSI for 1-byte character sets?


回答1:


You have to encode bytes into text. You can use rawtohex function or utl_encode package. For displaying characters you have to use inverse function and then convert raw bytes to varchar2. Use utl_raw.cast_to_varchar2.



来源:https://stackoverflow.com/questions/14452931/how-can-i-store-bytes-in-oracle-varchar2-and-have-ascii-treated-as-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!