简体   繁体   English

文本文件的Oracle数据类型?

[英]Oracle Data Type for text file?

I need to create a table in Oracle that will store a series of large text files. 我需要在Oracle中创建一个表,它将存储一系列大型文本文件。 After looking at the Oracle datatype's it is unclear what type I should use to store the files. 在查看Oracle数据类型之后,我不清楚应该使用哪种类型来存储文件。

The limits on the text specific types like VARCHAR2 seem very small (32K). 像VARCHAR2这样的文本特定类型的限制似乎非常小(32K)。 The other types don't seem to be the right match for a text file (eg BFILE). 其他类型似乎不是文本文件的正确匹配(例如BFILE)。

Does anyone have an opinion on the right type to use? 有没有人对正确使用的类型有意见?

The difference between CLOB and BLOB/BFILE is that CLOBs are treated as Text. CLOB和BLOB / BFILE之间的区别在于CLOB被视为Text。 That is, if you pull a CLOB from the database it will do any conversion necessary from the database character set to the client character set (eg removing an accent from an ê). 也就是说,如果从数据库中提取CLOB,它将执行从数据库字符集到客户端字符集所需的任何转换(例如,从ê中删除重音)。 Similarly, when a CLOB is created by a client, there can be a conversion from the client character set to the database character set. 类似地,当客户端创建CLOB时,可以存在从客户端字符集到数据库字符集的转换。 If both client and database character sets are the same, then no conversion is needed or performed. 如果客户端和数据库字符集相同,则不需要或不执行转换。

NCLOB is like CLOB except that rather than the database character set, the conversion uses the NLS NCHAR characterset. NCLOB与CLOB类似,不同之处在于转换使用NLS NCHAR字符集,而不是数据库字符集。

A BLOB/BFILE will not be subject to the conversion rules. BLOB / BFILE不受转换规则的约束。

So GENERALLY I would use a CLOB for text, but if there is some checksum/audit trail logic where I don't want even the slightest possibility of a character set conversion, I might opt for a BLOB/BFILE. 所以我通常会使用CLOB作为文本,但是如果有一些校验和/审计跟踪逻辑,我甚至不想进行字符集转换,我可能会选择BLOB / BFILE。 I wouldn't consider a LONG or LONG RAW. 我不会考虑长期或长期。

取决于您使用的CLOB或Long的Oracle版本

The LOB datatypes for character data are CLOB and NCLOB. 字符数据的LOB数据类型是CLOB和NCLOB。 They can store up to 8 terabytes of character data (CLOB) or national character set data (NCLOB). 它们可以存储多达8TB的字符数据(CLOB)或国家字符集数据(NCLOB)。

Later Oracle recommends that you convert existing LONG RAW columns to LOB columns. 稍后Oracle建议您将现有的LONG RAW列转换为LOB列。 LOB columns are subject to far fewer restrictions than LONG columns. 与LONG列相比,LOB列的限制要少得多。 Further, LOB functionality is enhanced in every release, whereas LONG RAW functionality has been static for several releases. 此外,LOB功能在每个版本中都得到了增强,而LONG RAW功能在几个版本中都是静态的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM