From: | Eduardo Muñoz <eduardomc_79(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Problem with function that returns a cursor |
Date: | 2006-03-03 17:06:20 |
Message-ID: | 20060303170620.66255.qmail@web36207.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I'm new to pgSQL and I'm having some trouble with a
function. I keep getting the following error:
org.postgresql.util.PSQLException: ERROR: cursor
"<unnamed portal 1>" does not exist
This is the function:
CREATE OR REPLACE FUNCTION ret_user(pusername
"varchar")
RETURNS refcursor AS
$BODY$
DECLARE
ccursor refcursor;
BEGIN
open ccursor for
select username,
password,
idrole
from user
where username = quote_literal($1);
RETURN ccursor;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
This is the JDBC code:
CallableStatement statement = null;
ResultSet rs = null;
Connection connection =
ConnectionPool.getConnection(saJNDI);
try{
statement = connection.prepareCall("{? =
call ret_user(?)");
statement.registerOutParameter(1,
Types.OTHER);
statement.setObject(2, "munoze");
statement.execute();
rs = (ResultSet)statement.getObject(1);
while(rs.next()){
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
}
rs.close();
statement.close();
} catch(SQLException e){
}
I hope you can help me
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2006-03-03 17:10:04 | Re: ERROR: column "datpath" does not exist |
Previous Message | Sascha Nepper | 2006-03-03 16:38:45 | Re: ERROR: column "datpath" does not exist |