X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ABA1C3ABCA0 for ; Tue, 21 Dec 2004 21:20:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99780-03 for ; Tue, 21 Dec 2004 21:20:25 +0000 (GMT) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id E4FC83ABCA5 for ; Tue, 21 Dec 2004 21:20:25 +0000 (GMT) Received: (qmail invoked by alias); 21 Dec 2004 21:20:24 -0000 Received: from pop-mu-5-1-dialup-174.freesurf.ch (EHLO [194.230.189.174]) (194.230.189.174) by mail.gmx.net (mp026) with SMTP; 21 Dec 2004 22:20:24 +0100 X-Authenticated: #9655330 Message-ID: <41C8934F.9060403@gmx.ch> Date: Tue, 21 Dec 2004 22:19:11 +0100 From: Jerome Colombie User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: CallableStatement: java.sql.Types=12 however type java.sql.Types=1111 was registered Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200412/157 X-Sequence-Number: 11823 Hi I get the following error: org.postgresql.util.PSQLException: A CallableStatement function was executed and the return was of type java.sql.Types=12 however type java.sql.Types=1111 was registered. when running the following code: conn.setAutoCommit(false); CallableStatement stmt = conn.prepareCall("{ ? = call myfunction1() }"); stmt.registerOutParameter(1, Types.OTHER); stmt.execute(); ResultSet rs = (ResultSet) stmt.getObject(1); while (rs.next()) { result = result + rs.getString(1); result = result + rs.getDouble(2); } create type b_line as (account_text varchar(255), amount numeric); CREATE OR REPLACE FUNCTION myfunction1() RETURNS setof b_line AS $BODY$DECLARE tmp1 numeric; account RECORD; r b_line%rowtype; BEGIN tmp1 = 0.00; FOR i IN 30..39 LOOP FOR account IN SELECT id, account_id, name, type, amount_cred FROM bo.obj_ledger WHERE account_id like (i || '__') ORDER BY id LOOP IF account.type = 'P' THEN tmp1 = tmp1 + account.amount_cred; ELSE tmp1 = tmp1 - account.amount_cred; END IF; END LOOP; END LOOP; r.account_text = 'Line1:'; r.amount = tmp1; return next r; RETURN; END;$BODY$ LANGUAGE 'plpgsql' VOLATILE; I'm using the following versions: pg80b1.308.jdbc3.jar PostgreSQL 8.0.0rc1 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.3.1 (mingw special 20030804-1) Thanks for your help. Regards, Jerome