×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

calling a stored procedure

calling a stored procedure

calling a stored procedure

(OP)
Hello All!

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

Thanks

RE: calling a stored procedure

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.

   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;
   }


Tone

RE: calling a stored procedure

(OP)
Thank you ,Tone!
I'll try it.
I.

RE: calling a stored procedure

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close