Skip site navigation (1) Skip section navigation (2)

Using User Defined Type in JDBC code

From: Gunjeet Singh <Gunjeet(dot)Singh(at)Sun(dot)COM>
To: pgsql-jdbc(at)postgresql(dot)org, Gunjeet(dot)Singh(at)Sun(dot)COM
Subject: Using User Defined Type in JDBC code
Date: 2004-03-25 23:46:35
Message-ID: 40636F5B.5040900@Sun.COM (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi,

Can somone tell me how I can call a pl/pgsql stored function
that returns a user-defined type from the JDBC code ?

What type do you use while registering the out parameter for a function 
that returns a user-defined type ?

Please see the type definition and function definition below.
The function gets created successfully but I don't know how to test them 
from sql prompt or even more importantly from JDBC code.

create type gs_demotype as (
   value1 text,
   value2 text,
   value3 REFCURSOR );


create function string_n_refcursor()
returns gs_demotype
as '
   declare
    rval demotype;
    rc     REFCURSOR;
   begin
    rval.value1 := ''some string'';
    rval.value2 := ''some other string'';
    OPEN rc FOR SELECT name,location FROM cities;
    rval.value3 := rc;
    return rval;
   end;
' language 'plpgsql';

Thanks,

Gunjeet




pgsql-jdbc by date

Next:From: Gunjeet SinghDate: 2004-03-26 00:05:52
Subject: Using User Defined Type in JDBC code
Previous:From: Dave CramerDate: 2004-03-25 15:11:01
Subject: Re: ArrayIndexOutOfBoundsException - bug?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group