Unix Technical Forum

Remote Function Call Oracle: Internal Error

This is a discussion on Remote Function Call Oracle: Internal Error within the Oracle Database forums, part of the Database Server Software category; --> I am writing stored proecdures on Oracle 9 (release 1 I believe). I am having difficulty creating a stored ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-23-2008, 04:33 AM
Kid A
 
Posts: n/a
Default Remote Function Call Oracle: Internal Error

I am writing stored proecdures on Oracle 9 (release 1 I believe). I am
having difficulty creating a stored procedure that makes a remote
function call to a database on a different host.

On the remote database I declare the following package:

----------

create or replace package remote_package
as
cursor cursor_a is select * from my_table;
type my_table_tab is table of cursor_a%ROWTYPE;

----------

I declare the following function

---------
create or replace function my_function return
remote_package.my_table_tab

as
indx NUMBER;

BEGIN
open remote_package.cursor_a;
indx := 0;
for rec_a in remote_package.cursor_a
loop
my_table_tab(indx) := rec_a;
indx := indx + 1;
end loop;

END;
-----------------


On my local database, I have the following procedure written:


-------------------------
create or replace procedure call_remote

as

a_table remote_package.my_table_tab@REMOTE_HOST

begin
a_table := my_function@REMOTE_HOST;
end;
--------------------------------

When I run the local SQL statement to create the procedure, I get the
following error:

PLS-00801: INTERNAL ERROR[1401]

I made sure that:
@REMOTE_HOST is valid
When I deploy the package and functions locally, everything works
perfectly.

For some reason calling the package and function that is passing back
a table of records is just not working and I am not sure why. Any
help would be greatly appreciated, thanks!

-PK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-23-2008, 04:35 AM
Frank
 
Posts: n/a
Default Re: Remote Function Call Oracle: Internal Error

Kid A wrote:

> I am writing stored proecdures on Oracle 9 (release 1 I believe). I am
> having difficulty creating a stored procedure that makes a remote
> function call to a database on a different host.
>
> On the remote database I declare the following package:
>
> ----------
>
> create or replace package remote_package
> as
> cursor cursor_a is select * from my_table;
> type my_table_tab is table of cursor_a%ROWTYPE;
>
> ----------
>
> I declare the following function
>
> ---------
> create or replace function my_function return
> remote_package.my_table_tab
>
> as
> indx NUMBER;
>
> BEGIN
> open remote_package.cursor_a;
> indx := 0;
> for rec_a in remote_package.cursor_a
> loop
> my_table_tab(indx) := rec_a;
> indx := indx + 1;
> end loop;
>
> END;
> -----------------
>
>
> On my local database, I have the following procedure written:
>
>
> -------------------------
> create or replace procedure call_remote
>
> as
>
> a_table remote_package.my_table_tab@REMOTE_HOST
>
> begin
> a_table := my_function@REMOTE_HOST;
> end;
> --------------------------------
>
> When I run the local SQL statement to create the procedure, I get the
> following error:
>
> PLS-00801: INTERNAL ERROR[1401]
>
> I made sure that:
> @REMOTE_HOST is valid
> When I deploy the package and functions locally, everything works
> perfectly.
>
> For some reason calling the package and function that is passing back
> a table of records is just not working and I am not sure why. Any
> help would be greatly appreciated, thanks!
>
> -PK

You cannot use ref cursors over db links

--
Regards, Frank van Bortel

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-23-2008, 04:35 AM
Kid A
 
Posts: n/a
Default Re: Remote Function Call Oracle: Internal Error

That was my first approach, but as you can see here, i'm not using the
cursor across the db link. I am calling the remote function which
takes the results and places them in a table of records. The table is
then passed across the db link. Isn't this possible? I mean it is
just a collection.

Frank <fbortel@nescape.net> wrote in message news:<bpe46m$b85$2@news3.tilbu1.nb.home.nl>...
> Kid A wrote:
>
> > I am writing stored proecdures on Oracle 9 (release 1 I believe). I am
> > having difficulty creating a stored procedure that makes a remote
> > function call to a database on a different host.
> >
> > On the remote database I declare the following package:
> >
> > ----------
> >
> > create or replace package remote_package
> > as
> > cursor cursor_a is select * from my_table;
> > type my_table_tab is table of cursor_a%ROWTYPE;
> >
> > ----------
> >
> > I declare the following function
> >
> > ---------
> > create or replace function my_function return
> > remote_package.my_table_tab
> >
> > as
> > indx NUMBER;
> >
> > BEGIN
> > open remote_package.cursor_a;
> > indx := 0;
> > for rec_a in remote_package.cursor_a
> > loop
> > my_table_tab(indx) := rec_a;
> > indx := indx + 1;
> > end loop;
> >
> > END;
> > -----------------
> >
> >
> > On my local database, I have the following procedure written:
> >
> >
> > -------------------------
> > create or replace procedure call_remote
> >
> > as
> >
> > a_table remote_package.my_table_tab@REMOTE_HOST
> >
> > begin
> > a_table := my_function@REMOTE_HOST;
> > end;
> > --------------------------------
> >
> > When I run the local SQL statement to create the procedure, I get the
> > following error:
> >
> > PLS-00801: INTERNAL ERROR[1401]
> >
> > I made sure that:
> > @REMOTE_HOST is valid
> > When I deploy the package and functions locally, everything works
> > perfectly.
> >
> > For some reason calling the package and function that is passing back
> > a table of records is just not working and I am not sure why. Any
> > help would be greatly appreciated, thanks!
> >
> > -PK

> You cannot use ref cursors over db links

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-23-2008, 04:36 AM
Frank
 
Posts: n/a
Default Re: Remote Function Call Oracle: Internal Error

Kid A wrote:

> That was my first approach, but as you can see here, i'm not using the
> cursor across the db link. I am calling the remote function which
> takes the results and places them in a table of records. The table is
> then passed across the db link. Isn't this possible? I mean it is
> just a collection.
>
> Frank <fbortel@nescape.net> wrote in message news:<bpe46m$b85$2@news3.tilbu1.nb.home.nl>...
>
>>Kid A wrote:
>>
>>
>>>I am writing stored proecdures on Oracle 9 (release 1 I believe). I am
>>>having difficulty creating a stored procedure that makes a remote
>>>function call to a database on a different host.
>>>
>>>On the remote database I declare the following package:
>>>
>>>----------
>>>
>>>create or replace package remote_package
>>>as
>>>cursor cursor_a is select * from my_table;
>>>type my_table_tab is table of cursor_a%ROWTYPE;
>>>
>>>----------
>>>
>>>I declare the following function
>>>
>>>---------
>>>create or replace function my_function return
>>>remote_package.my_table_tab
>>>
>>>as
>>>indx NUMBER;
>>>
>>>BEGIN
>>>open remote_package.cursor_a;
>>>indx := 0;
>>>for rec_a in remote_package.cursor_a
>>>loop
>>>my_table_tab(indx) := rec_a;
>>>indx := indx + 1;
>>>end loop;
>>>
>>>END;
>>>-----------------
>>>
>>>
>>>On my local database, I have the following procedure written:
>>>
>>>
>>>-------------------------
>>>create or replace procedure call_remote
>>>
>>>as
>>>
>>>a_table remote_package.my_table_tab@REMOTE_HOST
>>>
>>>begin
>>>a_table := my_function@REMOTE_HOST;
>>>end;
>>>--------------------------------
>>>
>>>When I run the local SQL statement to create the procedure, I get the
>>>following error:
>>>
>>>PLS-00801: INTERNAL ERROR[1401]
>>>
>>>I made sure that:
>>>@REMOTE_HOST is valid
>>>When I deploy the package and functions locally, everything works
>>>perfectly.
>>>
>>>For some reason calling the package and function that is passing back
>>>a table of records is just not working and I am not sure why. Any
>>>help would be greatly appreciated, thanks!
>>>
>>>-PK

>>
>>You cannot use ref cursors over db links


Too fast - dunno where I got the ref cursor stuff from - apologies!
1) Why not use a locally defined cursor, reading from a remote table?
2) Suggest you try to replace your local "a_table" definition with
hard-coded values, as I doubt the PL/SQL engine is able to read
the remote dd.
Not in the position to test the scenario.
--
Regards, Frank van Bortel

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-23-2008, 04:46 AM
Kid A
 
Posts: n/a
Default Re: Remote Function Call Oracle: Internal Error

Frank et al,

It really is bizzarre. It just started working. I changed nothing.
A few days later, I compiled and i got the same unknown error. But a
day later it worked again, and has been for the last week. Maybe
because the remote instance of Oracle is 8i and my local one is 9i
(release 2) there is some sort of instability in the connection.

Anyway, thanks again.

-PK

Frank <fbortel@nescape.net> wrote in message news:<bpgjgc$gm4$1@news3.tilbu1.nb.home.nl>...
> Kid A wrote:
>
> > That was my first approach, but as you can see here, i'm not using the
> > cursor across the db link. I am calling the remote function which
> > takes the results and places them in a table of records. The table is
> > then passed across the db link. Isn't this possible? I mean it is
> > just a collection.
> >
> > Frank <fbortel@nescape.net> wrote in message news:<bpe46m$b85$2@news3.tilbu1.nb.home.nl>...
> >
> >>Kid A wrote:
> >>
> >>
> >>>I am writing stored proecdures on Oracle 9 (release 1 I believe). I am
> >>>having difficulty creating a stored procedure that makes a remote
> >>>function call to a database on a different host.
> >>>
> >>>On the remote database I declare the following package:
> >>>
> >>>----------
> >>>
> >>>create or replace package remote_package
> >>>as
> >>>cursor cursor_a is select * from my_table;
> >>>type my_table_tab is table of cursor_a%ROWTYPE;
> >>>
> >>>----------
> >>>
> >>>I declare the following function
> >>>
> >>>---------
> >>>create or replace function my_function return
> >>>remote_package.my_table_tab
> >>>
> >>>as
> >>>indx NUMBER;
> >>>
> >>>BEGIN
> >>>open remote_package.cursor_a;
> >>>indx := 0;
> >>>for rec_a in remote_package.cursor_a
> >>>loop
> >>>my_table_tab(indx) := rec_a;
> >>>indx := indx + 1;
> >>>end loop;
> >>>
> >>>END;
> >>>-----------------
> >>>
> >>>
> >>>On my local database, I have the following procedure written:
> >>>
> >>>
> >>>-------------------------
> >>>create or replace procedure call_remote
> >>>
> >>>as
> >>>
> >>>a_table remote_package.my_table_tab@REMOTE_HOST
> >>>
> >>>begin
> >>>a_table := my_function@REMOTE_HOST;
> >>>end;
> >>>--------------------------------
> >>>
> >>>When I run the local SQL statement to create the procedure, I get the
> >>>following error:
> >>>
> >>>PLS-00801: INTERNAL ERROR[1401]
> >>>
> >>>I made sure that:
> >>>@REMOTE_HOST is valid
> >>>When I deploy the package and functions locally, everything works
> >>>perfectly.
> >>>
> >>>For some reason calling the package and function that is passing back
> >>>a table of records is just not working and I am not sure why. Any
> >>>help would be greatly appreciated, thanks!
> >>>
> >>>-PK
> >>
> >>You cannot use ref cursors over db links

>
> Too fast - dunno where I got the ref cursor stuff from - apologies!
> 1) Why not use a locally defined cursor, reading from a remote table?
> 2) Suggest you try to replace your local "a_table" definition with
> hard-coded values, as I doubt the PL/SQL engine is able to read
> the remote dd.
> Not in the position to test the scenario.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com