非法使用 LONG 数据类型 00997。00000 - “非法使用 LONG 数据类型
illegal use of LONG datatype 00997. 00000 - "illegal use of LONG datatype
如果我有两个具有相同结构的 table,一个在 informix
中,另一个在 oracle
db.and 中,我想从 [=11 迁移照片=] 到 oracle
所以我使用 oracle 网关实现此迁移但它失败了,我收到以下错误:
SQL Error: ORA-00997: illegal use of LONG datatype
00997. 00000 - "illegal use of LONG datatype"
我的查询:
INSERT INTO EMPPHOTO (EMP_NUM,EMP_PIC,THUMB)
SELECT "emp_num","emp_pic","thumb" FROM "empmaster1pics"@GMR;
其中 EMPPHOTO
(oracle table ) 和 EMP_PIC --->BLOB
和
empmaster1pics
(informix table) 和 emp_pic --->Byte
你正在做一个隐式的 conversion from the Informix data type to the Oracle one. But you can't use to_lob()
with a remote table,这是显式的等价物。
您应该能够使用 PL/SQL 游标实现此目的,将查询和插入分开:
begin
for rec in (
select "emp_num", "emp_pic", "thumb"
from "empmaster1pics"@GMR
)
loop
insert into empphoto (emp_num, emp_pic, thumb)
values (rec."emp_num", rec."emp_pic", rec."thumb");
end loop;
end;
/
我没有要验证的 Informix 数据库,但它可以与 link 连接到 Oracle 数据库,以及 table 和 long raw
列,这是最接近的等同于您的 byte
列,并获得与您的原始代码相同的 ORA-00997。 (除非你在 table 中只能有一个 long raw
列,所以我只能用 emp_pic
或 thumb
进行测试,不能同时进行测试。
如果我有两个具有相同结构的 table,一个在 informix
中,另一个在 oracle
db.and 中,我想从 [=11 迁移照片=] 到 oracle
所以我使用 oracle 网关实现此迁移但它失败了,我收到以下错误:
SQL Error: ORA-00997: illegal use of LONG datatype 00997. 00000 - "illegal use of LONG datatype"
我的查询:
INSERT INTO EMPPHOTO (EMP_NUM,EMP_PIC,THUMB)
SELECT "emp_num","emp_pic","thumb" FROM "empmaster1pics"@GMR;
其中 EMPPHOTO
(oracle table ) 和 EMP_PIC --->BLOB
和
empmaster1pics
(informix table) 和 emp_pic --->Byte
你正在做一个隐式的 conversion from the Informix data type to the Oracle one. But you can't use to_lob()
with a remote table,这是显式的等价物。
您应该能够使用 PL/SQL 游标实现此目的,将查询和插入分开:
begin
for rec in (
select "emp_num", "emp_pic", "thumb"
from "empmaster1pics"@GMR
)
loop
insert into empphoto (emp_num, emp_pic, thumb)
values (rec."emp_num", rec."emp_pic", rec."thumb");
end loop;
end;
/
我没有要验证的 Informix 数据库,但它可以与 link 连接到 Oracle 数据库,以及 table 和 long raw
列,这是最接近的等同于您的 byte
列,并获得与您的原始代码相同的 ORA-00997。 (除非你在 table 中只能有一个 long raw
列,所以我只能用 emp_pic
或 thumb
进行测试,不能同时进行测试。