Calling a stored procedure with array parameters

From: peter mcgregor <pdm(at)advso(dot)co(dot)nz>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Calling a stored procedure with array parameters
Date: 2003-07-21 04:39:07
Message-ID: 439D1398-BB35-11D7-A096-003065E5EDC4@advso.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,
I am trying to call the following stored procedure

rooms=# select sp_copyRoomItems1('{9,2}','{1}');
sp_copyroomitems1
-------------------
2
(1 row)

from jdbc

using the following test code

ArrayList fromEquipments = new ArrayList();
for (int i=0; i < selectedFromEquipmentItems.count(); i++) {
Equipment fromEquipment =
(Equipment)selectedFromEquipmentItems.objectAtIndex(i);

fromEquipments.add(Library.getPrimaryKey(fromEquipment));
}
CallableStatement cstmt = connection.prepareCall("{ call
sp_CopyRoomItems1( ? , ? ) } ");
cstmt.setObject(1,fromEquipments);
cstmt.setObject(2,fromEquipments);

However, I get an error when this is run

The table for java.util.ArrayList is not in the database. Contact the
DBA, as the database is in an inconsistent state.

The code that I have seen on the net is all about returning arrays from
stored procedures.

Is it possible to pass an array to a stored procedure?

TIA

Peter McGregor

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tony Grant 2003-07-21 06:39:32 Re: Problems with Spanish Chars
Previous Message Oliver Jowett 2003-07-21 03:10:22 Re: Prepared Statements