On Fri, 23 Feb 2007, Mario Splivalo wrote:
> Hello again :)
>
> I have a PSQL function that accepts table-based-type as parametar:
>
> CREATE TABLE t1(c1 int4, c2 varchar);
>
> CREATE FUNCTION f1(t1) RETURNS VOID
> AS 'BEGIN RETURN END;' LANGUAGE 'plpgsql';
>
> Now, when I call this function from another function (or from psql, for
> instance), i need to do it like this:
>
> select f1(ROW(1, 'sometext'));
>
> How do I do that from JDBC? Usualy I did it like this:
>
> callStatement = conn.getCallStatement("{call f1(?, ?)}");
> ResultSet rs = s.executeQuery("select f1(ROW(1, 'sometext'));");
>
Why not conn.prepareCall("{call f1(ROW(?, ?)}") or
conn.prepareStatement("SELECT f1(ROW(?, ?))");
Technically the JDBC way would be to to create a class implementing
SQLData, but since the JDBC driver doesn't implement such a thing, one of
the above should work.
Kris Jurka