SQL> create table CUST
2 (
3 CUST_ID NUMBER(2) not null,
4 CN_NAME LONG,
5 E_NAME LONG
6 )
7 ;
create table CUST
(
CUST_ID NUMBER(2) not null,
CN_NAME LONG,
E_NAME LONG
)
ORA-01754: 表只能包含一个 LONG 类型的列
SQL> create index T_LONG on T_LONG (cn_name);
create index T_LONG on T_LONG (cn_name)
ORA-00997: 非法使用 LONG 数据类型
官方文档中对LONG类型的描述:
The LONG RAW datatype is provided for backward compatibility with existing applications.
For new applications, use the BLOB and BFILE datatypes for large amounts of binary data.
Oracle also 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
LONG RAW data cannot be indexed, but RAW
data can be indexed.
由此可以看出oracle推荐使用LOB columns 替换 LONG RAW colunns。
并且LONG RAW 的功能已经不被更新,而LOB 功能在保持更新。
LONG RAW 类型不能建索引。这也许就是oracle只能在表中建一个LONG类型列的原因之一吧。