Code for calling a stored procedure

Use Callable Statement

//con is your connection object


CallableStatement cstmt = con.prepareCall("{call sp_yourprocedurename(?,?}");
cstmt.registerOutparameter(2,java.sql.Types.FLOAT);
cstmt.setint(1,parameter1);
cstmt.execute();
out.println("Procedure output is :"+cstmt.getFloat(2));

The above example has a stored proc with 2 arguments , 2nd is output. You don't
need to registerOutparameter if
procedure has no out parameters , also no need to set values if there are no
input args.
This code can be called directly from the JSP if you have the connection object
or code it in a bean and access
bean methods from the JSP.

Santosh






Naveen Gupta <[EMAIL PROTECTED]> on 09/07/2000 07:56:43 AM

Please respond to A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Santosh Daryani/IT/Aon Consulting)

Subject:  how to use Oracle Stored Procedure



Pls tell me how to use Oracle Stored Procedure in JSP's

Naveen Gupta

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to