Subject Problem getting ResultSet from a Stored Procedure...
Author Nairo Granados Martinez
Hi All,

I have this stored procedures that returns the marital
status: It should return 4 lines.

CREATE PROCEDURE D_E_NIT_ESTA_CIVIL_L
RETURNS (
ID_AGENCIA INTEGER,
ID_ALMACEN INTEGER,
N_ESTADO_CIVIL INTEGER,
NOMBRE VARCHAR(60),
PROCESANDO VARCHAR(1))
AS

BEGIN

FOR SELECT
ID_AGENCIA,
ID_ALMACEN,
N_ESTADO_CIVIL,
NOMBRE,
PROCESANDO
FROM D_E_NIT_ESTA_CIVIL
INTO
:ID_AGENCIA,
:ID_ALMACEN,
:N_ESTADO_CIVIL,
:NOMBRE,
:PROCESANDO

DO
BEGIN
SUSPEND;
END
END

Then, I'll calling it from a JavaBean:

public ResultSet getEstadoCivil() throws SQLException
{
cs = conn.prepareCall("{call D_E_NIT_ESTA_CIVIL_L}");
cs.execute();
rst = (ResultSet) cs.getResultSet();
return rst;
}

And I pass this to a JSP to do a select:

<select name="EstadoCivil">
<option value="0">(Seleccione su estado
civil)</option>

<% //ahora busco los diferentes estados civiles
try
{
rst = Administrador.getEstadoCivil();

while(rst.next())
{
intEstadoCivil = rst.getInt(3);
strNombreEstadoCivil = rst.getString(4);
%>
<option selected
value="<%=intEstadoCivil%>"><%=strNombreEstadoCivil%></option>
<%
} // en while
} // end try
catch(SQLException error_1)
{
out.println (error_1);
}
finally
{
Administrador.setCerrarConeccion();
}
%>
</select>


It doens't thrown any error but instead of return the
four line contained at the database, it just print the
first line of the ResultSet.

Any idea why is this hapennig??

Thanks a lot.

Nairo Granados
Belnor LTDA.

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com