Getting null when call execute() on a stored proc in sybase



Hi,

I'm having trouble with a call to a stored procedure that I have
created in sybase.
The issue is the next: I have a stored procedure that should return a
select statement (I say should because it returns a select when I
execute from SQLAdvantage), but when I call execute(), it returns
false, and I call getUpdateCount() to see what is going on, and returns
1.
I'm using Jdk 1.4.2, jConnect5.5 and ASE Sybase 12.x
The code of the stored procedure is next:
<sp-code>
create procedure Analisis.sp_perssproyec032
@arg1 varchar(255) = null
as
declare @rut varchar(255)

select @rut=@arg1

select pe.rut_person as rut, pe.nom_nombre as nombre, pe.nom_appate
as apellido1, pe.nom_apmate as apellido2, pe.e_mail as email, 'S' as
interno
from sisper_db..sp_pers pe, sisper_db..sp_rutp rp

where rp.rut= @rut
and rp.cod_ficha = pe.cod_ficha
UNION select pe.rut, pe.nombre, pe.apellido1, pe.apellido2,
pe.email, 'N' as interno from ap_pers pe where pe.rut = @rut

return
</ sp-code>
And the java code that calls the procedure is this:
<java-method-code>
// se crea la cadena de llamada al procedimiento
String llamada = "{call Analisis.sp_perssproyec032 ( ? ) }";

try {
CallableStatement cs =
accesoBD.getConexion().prepareCall(llamada);
cs.setString(1, "10050894K");

boolean seEjecutoProcedimiento = cs.execute();
if (seEjecutoProcedimiento == false) {
count = cs.getUpdateCount();
System.out.println("El procedimiento devolvio falso con count=" +
count);
} else {

System.out.println("El procedimiento se ha ejecutado
correctamente");
ResultSet resultados = cs.getResultSet();

while (resultados.next()) {
String rut = resultados.getString(1);
String nombre = resultados.getString(2);

System.out.println("RESULTADO rut=" + rut + " nombre=" + nombre);
} // end while
} // end else
} catch (SQLException e) {
e.printStackTrace();
} finally {
// accesoBD.terminarLlamada();
accesoBD.cerrarBD();
}
</ java-method-code>
The thing that is messing my head is that when I execute the proc from
SQLAdvantage, it works. But when i run the java method it works like a
update statement.
Please help, because I'm going crazy with this thing.
Bye.

.



Relevant Pages

  • Re: Getting null when call execute() on a stored proc in sybase
    ... I'm having trouble with a call to a stored procedure that I have ... jConnect5.5 and ASE Sybase 12.x ... select pe.rut_person as rut, pe.nom_nombre as nombre, pe.nom_appate ... boolean getResultSet = ps.execute; ...
    (comp.lang.java.databases)
  • Re: Insert Proc to Sybase
    ... here the link to an exemple on how to do so ... I don't know if Sybase has a managed provider which you can use. ... how to execute the stored procedure from C#. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: how to use bcp command to output stored procedure result
    ... I am a newbie on sybase and unix. ... The stored procedure just create temp table, ... > "The Complete Sybase Replication Server Quick Reference Guide" ...
    (comp.databases.sybase)
  • Re: Asynchronous database calls
    ... While the Oracle and Sybase namespaces might not support the SqlClient asyn ops extensions, ... off the time consuming call to the middle tier and database. ... I would like to invoke a stored procedure and immediately free up the ...
    (microsoft.public.dotnet.framework.adonet)
  • Preventing returning results sets from a procedure, when it is called by another one
    ... Stored procedure B performs a tables' update and its ... Select field1, field2,.. ... Is there a better way in Sybase to prevent returning results set by ... procedure B without introducing a special change in it. ...
    (comp.databases.sybase)