您的位置:首页 > 其它

ORA-22992: cannot use&…

2017-05-02 11:01 525 查看
创建DBLINK后查询表数据返回错误ORA-22992,需要使用CHAR或RAW变量接收LOB对象

 

to
receive the LOB objects into variables defined as CHAR or
RAW.

 

 

参考文档:

 

Ora-22992 workaround (文档 ID 436707.1)



转到底部



In this
Document


Symptoms
Changes
Cause
Solution

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.2.0.4
[Release 10.2 to 11.2]

Information in this document applies to any platform.

Symptoms

When trying to select from a remote table,
getting  'ORA-22992: cannot use LOB locators
selected from remote tables.' as following:

1. From the remote database:

create
4000
user cris identified by cris;

grant connect, resource to cris;

conn cris/cris

create table test(id number, obj clob);

insert into test values(1,'sdfsdfsfd');

insert into test values(2, 'sdfsdfsfdvfgdfvgdfvdf');

commit;

2 From the local database:

create user cris identified by cris;

grant connect, resource, create database link to cris;

conn cris/cris

create database link torem using 'identification of the remote
database in the tnsnames.ora';

set serveroutput on

declare

my_ad clob;

BEGIN

SELECT obj INTO my_ad FROM test@torem where id=1;

dbms_output.put_line(my_ad);

END;

/

*

ERROR at line 1:

ORA-22992: cannot use LOB locators selected from remote
tables

ORA-06512: at line 4

Changes

Cause

Trying to select LOB column from a table at a
remote site using dblink.

Solution

The following link to documentation states that you can
successfully select form lob objects through dblink All what you
have to do is to receive the LOB objects into variables defined as
CHAR or RAW.

Oracle� Database Application Developer's Guide - Large
Objects  10g Release 2 (10.2)

Part Number B14249-01

Restrictions Removed inOracleDatabase 10g Release

http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_what.htm#CHDGGBCG http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_data_interface.htm#CACIFCJF
Here are the steps of how to do that:

1. Selecting a CLOB object through the
dblink:

 1.1 From the remote database:

create user cris identified by cris;

grant connect, resource to cris;

conn cris/cris

create table test(id number, obj clob);

insert into test values(1,'sdfsdfsfd');

insert into test values(2, 'sdfsdfsfdvfgdfvgdfvdf');

commit;

1.2 From the local database:

create user cris identified by cris;

grant connect, resource, create database link to cris;

conn cris/cris

create database link torem using 'identification of the remote
database in the tnsnames.ora';

set serveroutput on

declare

my_ad varchar(6000);

BEGIN

SELECT obj INTO my_ad FROM test@torem where id=1;

dbms_output.put_line(my_ad);

END;

/

2. Selecting a BLOB object through the dblink:

 2.1 From the remote database:

create user cris identified by cris;

grant connect, resource to cris;

conn cris/cris

create table test2(id number, obj blob);

insert into test2 values(1,empty_blob());

insert into test2 values(2,empty_blob());

commit;

2.2 From the local database:

create user cris identified by cris;

grant connect, resource, create database link to cris;

conn cris/cris

create database link torem using 'identification of the remote
database in the tnsnames.ora';

declare

my_ad raw(50);

BEGIN

SELECT obj INTO my_ad FROM test2@torem where id=1;

END;

/

 

参考:http://www.linuxidc.com/Linux/2011-12/48581.htm

另外,我们可以借助全局临时表,先把数据复制到临时表,再从临时表转移到你的目的表。

create global temporary table ipop_topic_temp

as select * from ipop_topic@prod.us.oracle.com
where rownum=1

insert into ipop_topic_temp

select * from ipop_topic@prod.us.oracle.com
where application_id=1000

insert into ipop_topic

select * from ipop_topic_temp

commit
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐