Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Stored Procedure Call
Stored Procedure Call [message #634296] Thu, 21 October 2010 07:47 Go to next message
Manuel is currently offline ManuelFriend
Messages: 5
Registered: October 2010
Junior Member

i'm trying to execute a simple stored procedure call with EclipseLink on an Oracle 10g database. The procedure is defined like this:

PROCEDURE test_procedure (input_vch IN VARCHAR2, output_vch OUT VARCHAR2)
     output_vch := 'Gl├╝ckwunsch - Aufruf Erfolgreich! Eingabe war: ' || input_vch;
    END test_procedure;

And my EclipseLink code looks like this (just copied and adapted from the user guide example):
StoredFunctionCall functionCall = new StoredFunctionCall();
functionCall.addNamedArgument("INPUT_VCH");functionCall.setResult("OUTPUT_VCH", String.class);
ValueReadQuery query = new ValueReadQuery();
List args = new ArrayList();
String valid = (String) session.executeQuery(query, args);

but this results in the following error:
[EL Warning]: 2010-10-21 09:42:14.395--DatabaseSessionImpl(27021384)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: Row 1, Column 14:
PLS-00306: Wrong number or type of arguments in call of 'TEST_PROCEDURE'
ORA-06550: Row 1, Column 7:
PL/SQL: Statement ignored

Error Code: 6550
	bind => [=> OUTPUT_VCH, Eingabe]
Query: ValueReadQuery()

Any idea how to correct this?

I'm not that familiar with stored procedures, but on first sight my code seems valid, because it defines 1 input parameter.

Re: Stored Procedure Call [message #634396 is a reply to message #634296] Thu, 21 October 2010 14:39 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1300
Registered: July 2009
Senior Member
Hello MS,
The procedure in the database has both an IN and and OUT parameter, so you'll need to specify both types in a StoredProcedureCall in Eclipselink. The StoredFunctionCall is for functions that return values, which won't work for a StoredProcedure. Try using the addNamedOutputArgument("OUTPUT_VCH", "OUTPUT_VCH", String.class);
instead of the setResult().

Best Regards,
Re: Stored Procedure Call [message #635532 is a reply to message #634296] Wed, 27 October 2010 09:22 Go to previous message
Manuel is currently offline ManuelFriend
Messages: 5
Registered: October 2010
Junior Member
thanks ... works fine Smile
Previous Topic:Query.setMaxResults(0) seems to fail
Next Topic:Need to figure out how to properly configure EclipseLink
Goto Forum:

Current Time: Fri Jun 22 15:41:45 GMT 2018

Powered by FUDForum. Page generated in 0.01970 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top