Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling a stored procedure

Status
Not open for further replies.

irinka

Programmer
Aug 8, 2001
13
US
Hello All!

Did anyone used to call a stored procedure from the code?
What's the trick?

Thanks
 
I'm using Pages and I call stored procedures in Oracle by putting the call to the procedure in an Invoked Business Object and invoking that object from my Page. The Invoked Business Object would Look something like the following code.

[tt]Hashtable hshParams = (Hashtable) evt.getParameter();
CallableStatement cstmt = null;
PreparedStatement stmt = null;
Connection con = null;

try
{
AgiDatabase dbObject = evt.getDatabase();
con = dbObject.getConnection(true);
stmt = con.prepareStatement("CALL SCHEMA.PACKAGE.FUNCTION(?, ?)");
stmt.setString(1, (String) hshParams.get("param1"));
stmt.setString(2, (String) hshParams.get("param2"));
stmt.executeUpdate();
}
catch (Exception e)
{
evt.setResult(e.toString());
System.err.println(e.toString());
}
finally
{
stmt.close();
con.close();
return;
}[/tt]

Tone
 
I am calling stored procedure in SQL.
It'seems that something doesn't work.
The code is very similar to Tones'.
Does anyone have any examples or can suggest a good book with the examples.

Thanks
I.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top