niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle
Why does Oracle call external procedures multiple times?
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
Author Message
Michael Schaefers
*nix forums beginner


Joined: 03 Feb 2005
Posts: 3

PostPosted: Tue Feb 08, 2005 3:09 pm    Post subject: Why does Oracle call external procedures multiple times? Reply with quote

Hi there,

I have written a function within a package, that returns a new instance of an
object type. This function is implemented in C. Whenever I call this function
once, the C code is executed FOUR times! Please see the following example:

CREATE TYPE foo AS OBJECT(
type INT,
len INT
) NOT FINAL INSTANTIABLE;

CREATE PACKAGE pkg AS
FUNCTION fooTest(w IN int) RETURN foo;
END;

CREATE PACKAGE BODY pkg AS
FUNCTION fooTest(w IN int) RETURN foo
IS EXTERNAL LANGUAGE C LIBRARY myLib NAME "fooTest"
WITH CONTEXT
PARAMETERS (
CONTEXT,
w,
w INDICATOR SHORT,
return INDICATOR struct
);
END;

My C function just creates a new foo instance and returns it:

foo* fooTest(OCIExtProcContext* ctx, OCINumber* i,
OCIInd *i_ind, foo_ind **ret_ind)
{
debugf(">>> entering fooTest");
foo *ret;
// here follows the OCIObjectNew Code
return ret;
}


When I say

DECLARE
f foo;
BEGIN
f := pkg.fooTest(42);
INSERT INTO tab VALUES (f);
END;

the C function is executed only once (as expected).
But when I execute something like

INSERT INTO tab VALUES (pkg.fooTest(42));

my C function is executed 4 times unless I declare the function fooTest
DETERMINISTIC (unfortunately, in the real world it isn't).

Does anybody know what I am doing wrong / what the reasons for this behavior are?

We are running Oracle 10g on a SuSE 9.0 Linux system.

Thank you very much.
Regards, Michael
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 3:13 am | All times are GMT
navigation Forum index » Databases » Oracle
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Postfix Multiple Relay Hosts? blaze Postfix 0 Wed Jun 25, 2008 5:02 am
No new posts Deliver msg to multiple hosts jures Postfix 2 Fri Feb 29, 2008 4:21 pm
No new posts Move Oracle 10g database to another location Selt Server 0 Fri Jul 21, 2006 2:14 pm
No new posts Oracle runtime Spitfire Server 0 Fri Jul 21, 2006 1:18 pm
No new posts Oracle Text Score Computation jatinder.1975@gmail.com Server 0 Fri Jul 21, 2006 1:00 pm

Libros Electronicos | Hacker | Credit Cards | Fast Loans | Mortgage
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2003s ][ Queries: 16 (0.1097s) ][ GZIP on - Debug on ]