Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Database Link / ORA-02018

Re: Database Link / ORA-02018

From: Marko Guntermann <marko_at_guntermann-online.de>
Date: Fri, 01 Oct 1999 20:47:59 +0100
Message-ID: <37F50FEF.98A52DF7@guntermann-online.de>


Kai Sodemann wrote:
>
> Hi,
>
> I have created a database package, in which I
> 1. Create a database link (DBMS_SQL)
> 2. select data from the remote database.
> 3. Drop the database link (DBMS_SQL)
>
> The problem is, that if I select data from the remote system,
> I can not drop the database link anymore. I get the following error:
>
> ORA-02018: database link of same name has an open connection
> ....

Hello Kai,

If you use things like

  FOR c IN (SELECT...) LOOP
  ...
  END LOOP; there is an implicit cursor opened.

I'm not sure if following works but it may work. Use instead of FOR-LOOP:

CURSOR <cursor> IS SELECT ...;
BEGIN
  OPEN <cursor>;
  LOOP
    FETCH <cursor> INTO ...;
    EXIT WHEN <cursor>%NOTFOUND;
    ...
  END LOOP
  CLOSE <cursor>;

and make an COMMIT; before dropping the link.

If this does'nt work insert into the init-ORA the parameter

        close_open_cursor_on_commit=true
and restart the database (the name of the parameter may slightly be different).   

Good luck
  Marko Received on Fri Oct 01 1999 - 14:47:59 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US