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 1CF0953AB2 for ; Mon, 28 Mar 2005 10:26:26 +0100 (BST) 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 88728-01 for ; Mon, 28 Mar 2005 09:26:24 +0000 (GMT) Received: from posta.erciyes.edu.tr (posta.erciyes.edu.tr [193.255.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id E5A0453A06 for ; Mon, 28 Mar 2005 10:26:21 +0100 (BST) Received: from localhost (localhost [127.0.0.1]) by posta.erciyes.edu.tr (Postfix) with ESMTP id 53F2EED6C for ; Mon, 28 Mar 2005 11:21:58 +0200 (EET) Received: from [10.70.8.192] (unknown [193.255.88.12]) by posta.erciyes.edu.tr (Postfix) with ESMTP id 4EAC7EF1F for ; Mon, 28 Mar 2005 11:21:44 +0200 (EET) Message-ID: <4247CE6B.7050704@spymac.com> Date: Mon, 28 Mar 2005 12:29:15 +0300 From: John Smith User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: tr-TR, tr, en-US, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: problem with returning a table Content-Type: text/plain; charset=ISO-8859-9; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by Erciyes University Antivirus System X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.583 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, UPPERCASE_25_50 X-Spam-Level: * X-Archive-Number: 200503/205 X-Sequence-Number: 12597 Hi everybody, There is a function that returns a table. I set out parameter's type to Types.OTHER but When I call the function in java, returning type is returned as INTEGER . Here is the function: CREATE OR REPLACE FUNCTION sube_getir(int4, "varchar") RETURNS SETOF subeler AS $BODY$ DECLARE id ALIAS FOR $1; ad ALIAS FOR $2; ref record; BEGIN IF (id=0)AND(ad='') THEN for ref in SELECT * FROM subeler loop RETURN NEXT ref; end loop; return; ELSEIF (ad='') THEN for ref in SELECT * FROM subeler WHERE "HESAP_SUBE_ID"=id loop return next ref; end loop; return; ELSE for ref in SELECT * FROM subeler WHERE "HESAP_SUBE_ADI"=ad loop return next ref; end loop; return; END IF; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; ALTER FUNCTION sube_getir(int4, "varchar") OWNER TO postgres; --------calling function in java: sc = conn.prepareCall("{ ? = call sube_getir( ? , ? ) }"); sc.registerOutParameter(1,Types.OTHER); sc.setInt(2,4); sc.setString(3,""); sc.execute(); rs = (ResultSet)sc.getObject(1);