Oracle:使用 to_lob 从 user_ind_expressions 转换 column_expression 时出现 ORA-00932
尝试在 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);
这会导致以下错误:
ERROR at line 1: ORA-00932:不一致的数据类型:预期 - 变得很长
如果我像这样省略 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 行。
到底是怎么回事?
Try running these two simple statements on 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
If I omit the WHERE NOT EXISTS like this:
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.
What is going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 Michel Cadot 说这是一个错误,那么它几乎当然是一个错误。
If Michel Cadot says its a bug, then its almost certainly a bug.
是的,看起来是这样。
http://www.orafaq.com/forum/m/352199/130782 /#msg_352199
Yep, seems like it.
http://www.orafaq.com/forum/m/352199/130782/#msg_352199