Java - CallableStatement MySQL

 
Vista:

CallableStatement MySQL

Publicado por alejandra (2 intervenciones) el 17/06/2008 17:28:38
hola a todo el mundo
tengo un pequeño problema con un SP que esta guardado en una BD de MySQL
al momento de correr el callable statement me dice:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Result consisted of more than one row

y no se si sea un error en mi codigo, o sea que el SP este mal
si alguien me puede ayudar muchas gracias
hasta pronto

con esto mando llamar al SP, antes de hacer esto hago una consulta con un statement y un executequery, y funciona perfecto, pero necesito hacer funcionar el SP.

ResultSet rs1 = null;
CallableStatement cStmt = conexion.prepareCall("{ call prueba1(?,?)}");
cStmt.registerOutParameter(1, Types.VARCHAR);
cStmt.registerOutParameter(2, Types.INTEGER);
cStmt.execute();
rs1 = (ResultSet)cStmt.getObject(1);
while(rs1.next()){
System.out.println (rs1.getString (1) + " " + rs1.getInt (2));
}

y este es mi SP, la tabla solo tiene esos dos campos.

DELIMITER $$

DROP PROCEDURE IF EXISTS `alco`.`prueba1` $$
CREATE PROCEDURE `prueba1`(out nom varchar(20), out ed integer)
begin
declare nom varchar(20);
declare ed integer;
select * into nom, ed from empleados;
end $$

DELIMITER ;

muchas gracias a todos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder