Problem with function that returns a cursor
| От | Eduardo Muñoz |
|---|---|
| Тема | Problem with function that returns a cursor |
| Дата | |
| Msg-id | 20060303170620.66255.qmail@web36207.mail.mud.yahoo.com обсуждение исходный текст |
| Ответы |
Re: Problem with function that returns a cursor
|
| Список | 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/
В списке pgsql-general по дате отправления: