• Post Reply Bookmark Topic Watch Topic
  • New Topic

Get a function result

 
Joey Alencar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to know how can I get the result of a function in my Oracle database (like a Stored Procedure).
 
Ryan Alexander
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joey Alencar:
I'd like to know how can I get the result of a function in my Oracle database (like a Stored Procedure).

We need more information please. Could you post the platform you're running (like JRun, Tomkat, WebSphere, etc...) I mostly work with JRun, here's a snippet I use to get access to a database (you'll have to forgive me for changing address and passwords of course) This code only really executes a query.

Hope this helps!!!
 
Rehan Malik
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to assume that you want to retrieve database results from Oracle??
If so, the above steps mentioned by Ryan Alexander should work.
However, you MAY need to modify the code a little bit to work as you need. For example, I only use "execute()" when I don't know what the sql statment will be. If I do know that I'm using a "select" statement, then use the following:
ResultSet rs = stmt.executeQuery(query);
If you know that you are inserting, deleting or updating rows in the table, then you could use:
int i = stmt.executeUpdate(query);
In this example, i would return the number of rows affected by the change.
I hope this helps.
PS - You could also post this question on the JDBC forum as well to get more answers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!