how to pass an array to the plpgsql function from Java Code

From: "Sandeep Kumar Jakkaraju" <sandeepkumar(dot)jakkaraju(at)gmail(dot)com>
To: Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: how to pass an array to the plpgsql function from Java Code
Date: 2007-03-04 16:34:31
Message-ID: c653c98f0703040834he6ec066je10e8c58abf8755a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

how to pass an array to the plpgsql function from Java Code ??
say from a JDBC preparedStatement ....

Example :-

create or replace function test( x integer[] ) returns integer as
$BODY$
BEGIN
RETURN x[0];
END ;
language 'plpgsql'

JDBC CODE :-

int [] ar = {1,2,3};

PreparedStament pre= connection.prepareStatement( " select test(?) ");

pre.setArray(1,ar};

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Don Lavelle 2007-03-04 16:46:34 Cannot digest subscribe
Previous Message Nikolay Samokhvalov 2007-03-04 16:27:00 Re: xpath and xml namespaces