帮助我了解Oracle中的CLOB和BLOB之间的区别 [英] Help me understand the difference between CLOBs and BLOBs in Oracle
问题描述
这主要是检查我的理解"类型的问题.这是我对在Oracle中工作的CLOB和BLOB的理解:
This is mainly just a "check my understanding" type of question. Here's my understanding of CLOBs and BLOBs as they work in Oracle:
- CLOB用于XML,JSON等文本.您不应该假定数据库将使用哪种编码(至少在应用程序中)存储该编码,因为它将被转换为配置为数据库使用的任何编码. li>
- BLOB用于二进制数据.您可以合理地确定,它们将以您的发送方式存储,并且您将获得与发送时完全相同的数据.
换句话说,说我有一些二进制数据(在这种情况下,是一个腌制的python对象).我需要确保,当我发送它时,它将完全按照我的发送方式进行存储,而当我取回它时,它将完全相同. BLOB是我想要的,对吗?
So in other words, say I have some binary data (in this case a pickled python object). I need to be assured that when I send it, it will be stored exactly how I sent it and that when I get it back it will be exactly the same. A BLOB is what I want, correct?
为此使用CLOB真的可行吗?还是字符编码会引起足够的问题,这是不值得的?
Is it really feasible to use a CLOB for this? Or will character encoding cause enough problems that it's not worth it?
推荐答案
CLOB
对编码和排序规则敏感,对BLOB
不敏感.
CLOB
is encoding and collation sensitive, BLOB
is not.
当您使用CL8WIN1251
写入CLOB
时,您会写一个0xC0
(西里尔字母А).
When you write into a CLOB
using, say, CL8WIN1251
, you write a 0xC0
(which is Cyrillic letter А).
使用AL16UTF16
读回数据时,您会得到0x0410
,这是该字母的UTF16
表示形式.
When you read data back using AL16UTF16
, you get back 0x0410
, which is a UTF16
represenation of this letter.
如果您正在读取BLOB
,您将得到相同的0xC0
.
If you were reading from a BLOB
, you would get same 0xC0
back.
这篇关于帮助我了解Oracle中的CLOB和BLOB之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!