Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem executing stored procedure from jsp

 
koushik chakraborty
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hii all
i m trying to execute a stored procedure in oracle thru a jsp page.
i will give deptno=10 in the page and it will fetch all the employees in that particular department.
but after 1 min or so it is showing following error-:
error in DB connection RA-00600: internal error code, arguments: [12259], [], [], [], [], [], [], []
and then it is displaying only 1 employee name whereas there r 5 employess in that specific dept.
my jsp page code-:
<html>
<body bgcolor="abcdef">
<%@ page import="java.sql.*" %>
<%
try
{
int dno=Integer.parseInt(request.getParameter("deptnotxt"));
%>
<%@ include file="DbConn.jsp" %>
<table>
<tr>
<th>Employee Names</th>
</tr>
<%
CallableStatement cs=conn.prepareCall("{call empsearch(?,?)}");
cs.setInt(1,dno);
cs.registerOutParameter(2,Types.VARCHAR);
cs.execute();
ResultSet rs=cs.executeQuery();
String name="";
name=cs.getString(2);
while(rs.next())
{
%>
<tr>
<td><%= name %>
</td>
</tr>
<%
}
%>
</table>
<%
}
catch(Exception e)
{
out.println("error in DB connection:" + e.getMessage());
}
%>
</body>
</html>
my procedure code-:
create or replace procedure empsearch(v_deptno emp.deptno%type,v_ename out emp.ename%type)
as
cursor c1 is
select ename
from emp
where deptno=v_deptno;
begin
for c2 in c1
loop
v_ename:=c2.ename;
end loop;
end;
can u help me in solving out this error.
thanx in advance
koushik
 
Debashish Chakrabarty
Ranch Hand
Posts: 231
Firefox Browser Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two quick questions:
(1) Shouldn't the code:
be within your while loop? and
(2) Your procedure suggests you are only querying for a single field (employee name), how come the code above uses: getString(2)?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!