Re: Callable Statements
От | Nic Ferrier |
---|---|
Тема | Re: Callable Statements |
Дата | |
Msg-id | 87wui3lu4t.fsf@pooh-sticks-bridge.tapsellferrier.co.uk обсуждение исходный текст |
Ответ на | Callable Statements (Mark French <frenchmb@tpg.com.au>) |
Список | pgsql-jdbc |
Mark French <frenchmb@tpg.com.au> writes: > Hi, > > I'm new to postgres JDBC and was wondering if it supported callable > statements at all? The documentation doesn't have any examples and > would like to know it was possible to use them to call functions that > return multiple rows? An example would be greatly appreciated. > The CVS version of PG implements CallableStatements that can return multiple rows. Do it like this: try { CallableStatement proc = con.prepareCall("{ ? = call someproc (?) }"); proc.registerOutParameter(1, Types.OTHER); proc.setInt(2, 1); proc.execute(); ResultSet rs = (ResultSet) proc.getObject(1); while (rs.next()) { System.out.println("ha!"); } con.close(); } The proc should return a ref cursor type, much like it would in Oracle. The PL/PGSQL manual explains how to do that. Nic
В списке pgsql-jdbc по дате отправления: