As per below, I want to create a record into another database remotely which will work when I changed c1 to some string in insert query but when I use c1 object it will through error as per the title.
Please note: it's working fine on same remote without @, and using c1 object, tried other solution but no avail, can someone help me with a script for this dbms_lob. And its remote to another remote db insert
set define off;
Declare
c1 clob default ' ';
begin
dbms_lob.append(c1,chr(10));dbms_lob.append(c1,q'[DOCTYPE]');
Insert into SYSTEM_CONFIG@rtfqa (CONFIG_ID,NAME,VALUE_OLD,TYPE,SUB_TYPE,FROM_SYSTEM,TO_SYSTEM,VALUE) values ((select max(config_id)+1 from SYSTEM_CONFIG@rtfqa),'CONTRACT_HASHTAG_EN',null,'system','system',null,null,c1);
end;
ERROR
Insert into SYSTEM_CONFIG@rtfqa (CONFIG_ID,NAME,VALUE_OLD,TYPE,SUB_TYPE,FROM_SYSTEM,TO_SYSTEM,VALUE) values ((select max(config_id)+1 from SYSTEM_CONFIG@rtfqa),'CONTRACT_HASHTAG_EN',null,'system','system',null,null,c1);
end;
>Error report -
>ORA-06550: line 7, column 148:
>PL/SQL: ORA-22992: cannot use LOB locators selected from remote tables
>ORA-06550: line 7, column 1:
>PL/SQL: SQL Statement ignored
>06550. 00000 - "line %s, column %s:\n%s"
>*Cause: Usually a PL/SQL compilation error.
>*Action:
sql developer 18.2.0
DB = Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
There are various restrictions when using distributed LOBs. One way around this is to operate on a local LOB global temporary table as follows:
global temporary table
insert@remote as select from gtt
to copy the data overWhich looks like:
create table t (
c1 int, c2 clob
);
create global temporary table gtt as
select * from t
where 1 = 0;
declare
v2 clob default ' ';
begin
dbms_lob.append (
v2,
chr (10)
);
dbms_lob.append (
v2,
q'[DOCTYPE]'
);
insert into gtt (
c1, c2
) values (
1, v2
);
insert into t@loopback
select * from gtt;
end;
/
select * from t;
C1 C2
1
DOCTYPE
Loopback is a database link pointing back to the same database to simulate a remote DB .
如果有人仍然遇到同样的问题,他应该通过 sys 用户运行 dblink 命令例如使用 system 作为 sysdba 连接到数据库。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.