Thread: receiving user defined types from a function?

receiving user defined types from a function?

From
Dario Bahena
Date:
hi ...

I've a postgresql function, that returns a user defined composite type, 
is it posible to catch it using the jdbc driver???, cause then I tried 
it and saw the class for the object, it gave me just the first member 
for my composite type.

Maybe I can return a refcursor which should be mapped to a ResultSet in 
java ... but my functions would look less natural, in fact, I've already 
changed them cause PostgreSQL doesn't support out parameters.

Thankx.

salu2
dario estepario ...




Re: receiving user defined types from a function?

From
Kris Jurka
Date:

On Tue, 23 Mar 2004, Dario Bahena wrote:

> hi ...
> 
> I've a postgresql function, that returns a user defined composite type, 
> is it posible to catch it using the jdbc driver???, cause then I tried 
> it and saw the class for the object, it gave me just the first member 
> for my composite type.
> 

Instead of using a CallableStatement to call a function returning a
complex type the recommended method is to use a regular Statement or
PreparedStatement and simply call the function in a select such as:

SELECT * FROM mycomplexfunction('a',12);

Kris Jurka