尝试在 Oracle 10.2 上运行这两个简单的语句:
CREATE TABLE mytest
(table_name varchar2(30),
index_name varchar2(30),
column_expression clob,
column_position number);
INSERT INTO mytest
(table_name,
index_name,
column_expression,
column_position)
SELECT table_name, index_name,
to_lob(column_expression), column_position
FROM user_ind_expressions EXPRA
WHERE NOT EXISTS
(SELECT 1 FROM user_constraints
WHERE constraint_name = EXPRA.index_name
AND table_name = EXPRA.table_name);
这会导致此错误:
第 1 行的错误:ORA-00932:不一致的数据类型:预期 - 得到 LONG
如果我像这样省略 WHERE NOT EXISTS:
INSERT INTO mytest
(table_name,index_name,column_expression, column_position)
SELECT table_name,index_name,
to_lob(column_expression), column_position
FROM user_ind_expressions EXPRA;
有用:
创建了 23 行。
到底是怎么回事?