简体   繁体   中英

Oracle Data Type for text file?

I need to create a table in Oracle that will store a series of large text files. After looking at the Oracle datatype's it is unclear what type I should use to store the files.

The limits on the text specific types like VARCHAR2 seem very small (32K). The other types don't seem to be the right match for a text file (eg 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. 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 ê). Similarly, when a CLOB is created by a client, there can be a conversion from the client character set to the database character set. 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.

A BLOB/BFILE will not be subject to the conversion rules.

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. I wouldn't consider a LONG or LONG RAW.

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

The LOB datatypes for character data are CLOB and NCLOB. They can store up to 8 terabytes of character data (CLOB) or national character set data (NCLOB).

Later Oracle recommends that you convert existing LONG RAW columns to LOB columns. LOB columns are subject to far fewer restrictions than LONG columns. Further, LOB functionality is enhanced in every release, whereas LONG RAW functionality has been static for several releases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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