Question and Answer Database FAQ: FAQ4507B - Oracle database link, cursor, ORA-03106: fatal two-task communication protocol error Category: Database (Oracle) Platform: All-32Bit Product: All-CBuilder, BC++5.x, C++Builder1.0, C++Builder3.x, C++Builder4.x, Delphi2.x, Delphi3.x, Delphi4.x, VdBase7.x, Question: Why am I receiving the Oracle error ORA-03106: "fatal two-task communication protocol error" when using an Oracle database link and Oracle cursors? Answer: SQL> print rc1 ERROR: ORA-03106: fatal two-task communication protocol error ORA-02063: preceding line from MARSLNK As indicated in the SQL Plus output above this problem can be reproduced without using the BDE and/or BDE clients (Delphi, BCB, etc.). The example SQL Plus output shows examples show the creation of an Oracle database link, synonym, stored procedure, package, package building, along with the execution and "printing" of the Oracle cursor data. =========================== create public database link MARSLNK using 'srvr_tcp.borland.world' =========================== EXECUTE PROCEDURE AND FETCH DATA FROM CURSORS VIA SQL*PLUS: variable rctl refcursor; execute cursortest_4(:rctl); print rctl variable rc1 refcursor; execute cursortest_2(:rc1); print rc1 =========================== create or replace procedure cursortest_4 (rc1 in out DMOD.rctl) AS begin open rc1 for SELECT CUSTOMER_N, NAME FROM IDXCUSTM ORDER BY UPPER(NAME); end; =========================== create or replace procedure cursortest_2 (rc1 in out cursorpack.rctl) AS begin open rc1 for SELECT * FROM IDXCUSTM; end; =========================== create or replace package cursorpack IS type rctl is ref cursor return IDXCUSTM%rowtype; end; =========================== create or replace PACKAGE DMOD IS type rctl is ref cursor; end; =========================== Log in to the Oracle server as the administrator to create the public database link: SQL*Plus: Release 3.3.4.0.0 - Production on Thu Oct 22 16:36:15 1998 Copyright (c) Oracle Corporation 1979, 1996. All rights reserved. Connected to: Oracle7 Server Release 7.3.4.0.0 - Production With the distributed, replication and parallel query options PL/SQL Release 2.3.4.0.0 - Production SQL> CREATE PUBLIC DATABASE LINK MARSLNK USING 'srvr_tcp.borland.world'; Database link created. =========================== Log into the Oracle server as user to create the synonym, packages and procedures followed by execution of the procedures and printing/fetching the cursor rows: SQL*Plus: Release 3.3.4.0.0 - Production on Thu Oct 22 16:40:35 1998 Copyright (c) Oracle Corporation 1979, 1996. All rights reserved. Connected to: Oracle7 Server Release 7.3.4.0.0 - Production With the distributed, replication and parallel query options PL/SQL Release 2.3.4.0.0 - Production SQL> CREATE SYNONYM IDXCUSTM FOR IDXCUST@MARSLNK; Synonym created. SQL> create or replace PACKAGE DMOD 2 2 IS 3 3 type rctl is ref cursor; 4 4 end; 5 / Package created. SQL> create or replace package cursorpack IS 2 2 type rctl is ref cursor return IDXCUSTM%rowtype; 3 3 end; 4 / Package created. SQL> create or replace procedure cursortest_2 2 2 (rc1 in out cursorpack.rctl) AS 3 3 begin 4 4 open rc1 for 5 5 SELECT * 6 6 FROM IDXCUSTM; 7 7 end; 8 / Procedure created. SQL> create or replace procedure cursortest_4 (rc1 in out DMOD.rctl) AS 2 2 begin 3 3 open rc1 for 4 4 SELECT CUSTOMER_N, NAME 5 5 FROM IDXCUSTM 6 6 ORDER BY UPPER(NAME); 7 7 end; 8 / Procedure created. SQL> variable rctl refcursor; SQL> execute cursortest_4(:rctl); PL/SQL procedure successfully completed. SQL> print rctl ERROR: ORA-03106: fatal two-task communication protocol error ORA-02063: preceding line from MARSLNK no rows selected SQL> variable rc1 refcursor; SQL> execute cursortest_2(:rc1); PL/SQL procedure successfully completed. SQL> print rc1 ERROR: ORA-03106: fatal two-task communication protocol error ORA-02063: preceding line from MARSLNK no rows selected SQL> 7/13/99 10:49:35 AM
Article originally contributed by Bill Curtis