Oracle:使用to_lob从user_ind_expressions转换column_expression时的ORA-00932

时间:2022-09-15 20:07:31

Try running these two simple statements on Oracle 10.2:

尝试在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);

This results in this error:

这会导致此错误:

ERROR at line 1: ORA-00932: inconsistent datatypes: expected - got LONG

第1行的错误:ORA-00932:数据类型不一致:预期 - 变长

If I omit the WHERE NOT EXISTS like this:

如果我省略这样的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;

It works:

23 rows created.

创建了23行。

What is going on?

到底是怎么回事?

2 个解决方案

#1


1  

If Michel Cadot says its a bug, then its almost certainly a bug.

如果Michel Cadot说它是一个bug,那么它几乎肯定是一个bug。

#2


0  

Yep, seems like it.

是的,似乎是这样。

http://www.orafaq.com/forum/m/352199/130782/#msg_352199

#1


1  

If Michel Cadot says its a bug, then its almost certainly a bug.

如果Michel Cadot说它是一个bug,那么它几乎肯定是一个bug。

#2


0  

Yep, seems like it.

是的,似乎是这样。

http://www.orafaq.com/forum/m/352199/130782/#msg_352199