Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WKi0v-0000nG-7E for pgsql-sql@arkaria.postgresql.org; Tue, 04 Mar 2014 05:35:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WKi0u-0000lc-MA for pgsql-sql@arkaria.postgresql.org; Tue, 04 Mar 2014 05:35:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WKi0s-0000lM-Ot for pgsql-sql@postgresql.org; Tue, 04 Mar 2014 05:35:35 +0000 Received: from nm2-vm9.bullet.mail.sg3.yahoo.com ([106.10.148.98]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WKi0p-0000Zs-7k for pgsql-sql@postgresql.org; Tue, 04 Mar 2014 05:35:34 +0000 Received: from [106.10.166.125] by nm2.bullet.mail.sg3.yahoo.com with NNFMP; 04 Mar 2014 05:35:22 -0000 Received: from [106.10.150.23] by tm14.bullet.mail.sg3.yahoo.com with NNFMP; 04 Mar 2014 05:35:22 -0000 Received: from [127.0.0.1] by omp1024.mail.sg3.yahoo.com with NNFMP; 04 Mar 2014 05:35:22 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 73196.80853.bm@omp1024.mail.sg3.yahoo.com Received: (qmail 87003 invoked by uid 60001); 4 Mar 2014 05:35:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.in; s=s1024; t=1393911321; bh=5I7E8zRCjfwc3SYmf2iZODrNUbmjok3dJgpEB8Hy3yQ=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=2MV4CKBRqe2rnio5gEPw/RfWvIcHgSodmayhK4syJm6DPD/wpOxBjIA70HywFMDNetmpWVlendVw2MFcxYEvUSllsZIhmJbnrbKXeEoAII0qOxHuYhEeASAR5qv0jKpBZhfFor0Do5snXMsmRdjT31ZVKB9SBKhWuxZN72OihlI= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=XAS2F/XZK0S56yDtzrCIzIKrIRJujtNc1hqUCyntSbgziArPHmUodqypiLo04CPh8XfyGxn2H3ajsu+wnoP3HdY++SIZPaiA6vyRM0sA3zb1l+kOM3g6ikhlVN2aBuXUh0kUEv7KhZzHAI2J4u8KHYenkU85K/U/9fTeIwxXxI8=; X-YMail-OSG: 5inkENYVM1lM2eEGqKBRjZ7S5kXpLDmqorbHUjhgGaLYWdG RlRzcerAzrSBG69EWhKnnrWVuckK6354p7oUyJO14T3REZLQSWK2Dsv7kX2u Zf2pob0dDr1hwQxQj9ej47SG.42Fm48kc4J27vBN5tMHMPlL0smpxsAJxg0u rxrOydQ_HSHS8Tp32QLGOUpLLAp2YwNfoM11WOWPRTPGOqUCuUXyQ_rlCP3E MH4ND6rCkrikSlmQZEU9wnRuKNe5QZtB1fJUC4ZYDxQcSVOP3arJomkmh3l1 umO_WrVb0rKBj2NWGglavtTQkVLd6smu4dCsi18vBeoH52fCt4_FV2tvCkR0 uRdzLgEZ6BpIi4kAhu0semPpf4uj9NZkPKPr3bLa5gxj0BfONZ30EoHt2v74 L_FD6ozXbiul3EWR7T._RdAR7ch53PfR1wRQhwsp.S.k0jn21fg8clliLCE_ MddO7l88a1c.7gaWGdeF1pVRQcif0r87q20UJSJIubqa9Qk2V.ZCuT96_p64 Lk2EMSSTQlfxWEzLGdLGvC1g7Ok8UArZV.3PljUOSJfN5UZ.aQx3Z Received: from [155.70.23.45] by web192702.mail.sg3.yahoo.com via HTTP; Tue, 04 Mar 2014 13:35:21 SGT X-Rocket-MIMEInfo: 002.001, CgpIaSwKCkkgYW0gdXNpbmcgYmVsb3cgY29kZSBpbiBtdWx0aSB0aHJlYWRlZCBlbnZpcm9ubWVudCwgYnV0IHdoZW4gbXVsdGlwbGUgdGhyZWFkcyBhcmUgYWNjZXNzaW5nIHRoZW4gaSBnZXQgOiAib3JnLnBvc3RncmVzcWwudXRpbC5QU1FMRXhjZXB0aW9uOiBFUlJPUjogdHVwbGUgY29uY3VycmVudGx5IHVwZGF0ZWQiIGV4Y2VwdGlvbi4gQnV0IG15IGNvbmNlcm4gaXMgSSBuZWVkIHRvIHVzZSBpdCBpbiBtdWx0aSB0aHJlYWRlZCBlbnYsIApmb3IgdGhlIHNhbWUgcmVhc29uIEkgYW0gdXNpbmcgRk9SIFUBMAEBAQE- X-Mailer: YahooMailWebService/0.8.177.636 References: <1393502935.39715.YahooMailNeo@web192706.mail.sg3.yahoo.com> Message-ID: <1393911321.81761.YahooMailNeo@web192702.mail.sg3.yahoo.com> Date: Tue, 4 Mar 2014 13:35:21 +0800 (SGT) From: ALMA TAHIR Reply-To: ALMA TAHIR Subject: Re: pgsql-sq-owner To: "pgsql-sql-owner@postgresql.org" , "pgsql-sql@postgresql.org" , Tom Lane In-Reply-To: <1393502935.39715.YahooMailNeo@web192706.mail.sg3.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-221098236-106204446-1393911321=:81761" X-Pg-Spam-Score: -1.5 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org ---221098236-106204446-1393911321=:81761 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =0A=0AHi,=0A=0AI am using below code in multi threaded environment, but whe= n multiple threads are accessing then i get : "org.postgresql.util.PSQLExce= ption: ERROR: tuple concurrently updated" exception. But my concern is I ne= ed to use it in multi threaded env, =0Afor the same reason I am using FOR U= PDATE with cursor. Then where is the issue??? Am I missing something????? P= lease help me with the same.....=0A=A0=A0=A0 =A0=A0=A0 Statement stmt =3D c= .createStatement();=0A=A0=A0=A0 =A0=A0=A0=A0=A0 // Setup function to call.= =0A=A0=A0=A0 =A0=A0=A0=A0=A0 stmt.execute("CREATE OR REPLACE FUNCTION refcu= rsorfunc() RETURNS refcursor AS '"=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 + " DECLARE "=0A=A0=A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= + "=A0=A0=A0 call_log_rec call_log % rowtype; "=0A=A0=A0=A0 =A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 + "=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 call_log_c= ursor refcursor; "=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " f= inal_cursor refcursor; "=0A=A0=A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 + " idInt int[]; "=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + = " BEGIN "=0A=A0=A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + "=A0=A0= =A0 OPEN call_log_cursor FOR =0ASELECT * FROM call_log WHERE aht_read_statu= s =3D 0 ORDER BY =0Arecord_sequence_number ASC limit 20 FOR UPDATE; "=0A=A0= =A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " LOOP "=0A=A0=A0=A0 =A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " FETCH NEXT FROM call_log_cursor INTO = call_log_rec; "=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " EXIT= WHEN call_log_rec IS NULL; "=0A=A0=A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 + " UPDATE call_log SET aht_read_status =3D 1 WHERE CURRENT OF call_= log_cursor; "=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " idInt := =3D idInt || ARRAY [call_log_rec.record_sequence_number]; "=0A=A0=A0=A0 =A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " END LOOP;"=0A=A0=A0=A0=0A=0A =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " OPEN final_cursor FOR SELECT =0Arecord_s= equence_number FROM call_log WHERE record_sequence_number=A0 =3D =0AANY(idI= nt); "=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + "=A0=A0=A0 RETU= RN final_cursor; "=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 + " E= ND;' language plpgsql");=0A=A0=A0=A0 =A0=A0=A0=A0=A0=0A stmt.close();=0A=A0= =A0=A0 =A0=A0=A0=A0=A0 // We must be inside a transaction for cursors to wo= rk.=0A=A0=A0=A0 =A0=A0=A0=A0=A0 c.setAutoCommit(false);=0A=0A=A0=A0=A0 =A0= =A0=A0=A0=A0 // Procedure call.=0A=A0=A0=A0 =A0=A0=A0=A0=A0 CallableStateme= nt proc =3D c.prepareCall("{ ? =3D call refcursorfunc() }");=0A=A0=A0=A0 = =A0=A0=A0=A0=A0 proc.registerOutParameter(1, Types.OTHER);=0A=A0=A0=A0 =A0= =A0=A0=A0=A0 System.out.println("BEFORE::: Thread name::: " + Thread.curren= tThread().getName());=0A=A0=A0=A0 =A0=A0=A0=A0=A0 proc.execute();=0A=A0=A0= =A0 =A0=A0=A0=A0=A0 =0A=A0=A0=A0 =A0=A0=A0=A0=A0 ResultSet results =3D (Res= ultSet) proc.getObject(1);=0A=A0=A0=A0 =A0=A0=A0=A0=A0 while (results.next(= )) {=0A=A0=A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0 // do something with the re= sults...=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 System.out.println("Hurrey got the results from SP........");=0A= =A0=A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 System.out.println("AFTER::::Thread name::: " + =0AThread.currentThread= ().getName()+ " record_sequence_number:::: =0A"+results.getString(1));=0A= =A0=A0=A0 =A0=A0=A0=A0=A0 }=0A=A0=A0=A0 =A0=A0=A0=A0=A0 c.commit();=0A=A0= =A0=A0 =A0=A0=A0=A0=A0 results.close();=0A=A0=A0=A0 =A0=A0=A0=A0=A0 proc.cl= ose();=0A=0AThanks in advance Alma=0A=0A=0A=0A=0AOn Thursday, 27 February 2= 014 5:38 PM, ALMA TAHIR wrote:=0A =0AHi,=0A=0AI= t would be very helpful if anyone could help me with below issue.=0AI am us= ing below stored proc:=0A=A0CREATE OR REPLACE FUNCTION FETCH_CALL_LOGS() RE= TURNS refcursor AS $$=0ADECLARE=0Acall_log_rec call_log % rowtype;=0Acall_l= og_cursor refcursor;=0ABEGIN=0AOPEN call_log_cursor FOR=0ASELECT *=0AFROM = =0A=A0 call_log =0A=A0=A0=0A WHERE aht_read_status =3D 0 =0A=A0=A0=A0=A0=A0= =A0=A0=A0=A0 ORDER BY record_sequence_number ASC limit 20 FOR UPDATE;=0ALOO= P=0A=A0=A0=A0 FETCH NEXT FROM call_log_cursor INTO call_log_rec;=0A=A0=A0= =A0 EXIT WHEN call_log_rec IS NULL;=0A=A0=A0=A0 UPDATE call_log SET aht_rea= d_status =3D 1 WHERE record_sequence_number =3D call_log_rec.record_sequenc= e_number;=0AEND LOOP;=0ARETURN call_log_cursor;=0AEND;=0A$$ LANGUAGE plpgsq= l;=0A=0Aand trying to read response in java:=0A=0A=A0=A0=A0 =A0=A0=A0=A0=A0= =A0 java.sql.CallableStatement proc =3D=A0 c.prepareCall("{ ? =3D call fetc= h_call_logs() }");=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0 c.setAutoCommit(false);= =A0 =0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0 proc.registerOutParameter(1, java.sql.T= ypes.OTHER);=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0 proc.execute(); =0A=A0=A0= =A0 =A0=A0=A0=A0=A0=A0=A0=A0 ResultSet rset2 =3D (ResultSet) proc=0A=A0=A0= =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 .getObject(1);=0A=A0= =A0=A0=0A =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=0A while (rset2.next()) {=0A= =A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 System.out.println(= rset2=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= .getString(1));=0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }=0A= =A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 rset2.close();=0A=A0=A0=A0 = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // c.setAutoCommit(false);=0A=A0=A0=A0 = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 proc.close();=0A=A0=A0=A0 =A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 c.close();=0A=0Abut i ma not able to get proper re= sponse back... if i comment out the fetch statement and tried doing some st= atic update i am able to get proper =0Aresponse back. Stucked up with this.= ..=0AI want to open a ref cursor with select for update and then update the= records and get the ref cursor in response back in java.=0ABut=0A its not = happening .... if i return ref cursor only after select it =0Aworks fine bu= t after fetch when i am returning the response back i am =0Anot getting..Wh= ere am I doing the mistake or anything I am missing???? Please help me with= the same ... it would be very helpful..... ---221098236-106204446-1393911321=:81761 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

I am using below= code in multi threaded environment, but when multiple threads are accessin= g then i get : "org.postgresql.util.PSQLE= xception: ERROR: tuple concurrently updated"=0A exception. But my co= ncern is I need to use it in multi threaded env, =0Afor the same reason I a= m using FOR UPDATE with cursor. Then where is the=0A issue??? Am I missing = something????? Please help me with the same.....
<= /div>        <= /span>Statement stmt =3D c.createStatement();
&nbs= p;         // Setup function to call.          stmt.exec= ute("CREATE OR REPLACE FUNCTION refcursorfunc() RETURNS refcursor AS '"
           = ;            &n= bsp;            = ;      + " DECLARE "
  = ; =0A           &nbs= p;            &= nbsp;           &nbs= p;  + "    call_log_rec call_log % rowtype; "
           &nbs= p;            &= nbsp;           &nbs= p;     + "       &nb= sp;     call_log_cursor refcursor; "
=              &n= bsp;            = ;            &n= bsp;   + " final_cursor refcursor; "
 &nbs= p; =0A           &nb= sp;            =             &nb= sp;  + " idInt int[]; "
     &nb= sp;            =             &nb= sp;           + " BEGIN "=
   =0A      &nbs= p;            &= nbsp;           &nbs= p;       + "    OPEN call_log_= cursor FOR =0ASELECT * FROM call_log WHERE aht_read_status =3D 0 ORDER BY = =0Arecord_sequence_number ASC limit 20 FOR UPDATE; "
&nbs= p;  =0A          &nb= sp;            =             &nb= sp;   + " LOOP "
      = ;            &n= bsp;            = ;           + " FETCH NEX= T FROM call_log_cursor INTO call_log_rec; "
  &= nbsp;            &nb= sp;            =             &nb= sp; + " EXIT WHEN call_log_rec IS NULL; "
  &nb= sp;=0A            &n= bsp;            = ;            &n= bsp; + " UPDATE call_log SET aht_read_status =3D 1 WHERE CURRENT OF call_lo= g_cursor; "
        &n= bsp;            = ;            &n= bsp;        + " idInt :=3D idInt || ARRA= Y [call_log_rec.record_sequence_number]; "
  &n= bsp;            &nbs= p;            &= nbsp;           &nbs= p; + " END LOOP;"
   =0A=0A   &n= bsp;            = ;            &n= bsp;          + " OPEN final_c= ursor FOR SELECT =0Arecord_sequence_number FROM call_log WHERE record_seque= nce_number  =3D =0AANY(idInt); "
    =             &nb= sp;            =              + = "    RETURN final_cursor; "
  &n= bsp;            &nbs= p;            &= nbsp;           &nbs= p; + " END;' language plpgsql");
     = ;    =0A stmt.close();
  &n= bsp;       // We must be inside a transaction for = cursors to work.
       &nb= sp;  c.setAutoCommit(false);

&nbs= p;         // Procedure call.
          CallableStateme= nt proc =3D c.prepareCall("{ ? =3D call refcursorfunc() }");
          proc.registerOutParam= eter(1, Types.OTHER);
      &nbs= p;   System.out.println("BEFORE::: Thread name::: " + Thread.curr= entThread().getName());
      &n= bsp;   proc.execute();
     = ;    
      = ;    ResultSet results =3D (ResultSet) proc.getObject(1);
     =      while (results.next()) {
 &= nbsp; =0A           // do= something with the results...
     &= nbsp;           &nbs= p;        System.out.println("Hurrey got= the results from SP........");
   =0A &nb= sp;            =          System.out.println("AFTER:= :::Thread name::: " + =0AThread.currentThread().getName()+ " record_sequenc= e_number:::: =0A"+results.getString(1));
  &nbs= p;       }
    &n= bsp;     c.commit();
  &nbs= p;       results.close();
 =          proc.close();

Thanks in = advance Alma


On Thursday, 27 February 2014 5:38 PM, ALMA TAHIR <a= lmaheena2003@yahoo.co.in> wrote:
Hi,

It would be very helpfu= l if anyone could help me with below issue.
I am using below stored pro= c:
 CREATE OR REPLACE FUNCTION FETCH_CALL_LOGS() RETURNS refcursor= AS $$
DECLARE
call_log_rec call_log % rowtype;
call_log_cursor re= fcursor;
BEGIN
OPEN call_log_cursor FOR
SELECT *
FROM
 = ; call_log
  =0A WHERE aht_read_status =3D 0
  =         ORDER BY record_sequence_number = ASC limit 20 FOR UPDATE;
LOOP
    FETCH NEXT FROM call= _log_cursor INTO call_log_rec;
    EXIT WHEN call_log_rec= IS NULL;
    UPDATE call_log SET aht_read_status =3D 1 W= HERE record_sequence_number =3D call_log_rec.record_sequence_number;
END= LOOP;
RETURN call_log_cursor;
END;
$$ LANGUAGE plpgsql;

<= /div>
and trying to read response in java:

 &nbs= p;         java.sql.CallableStatement pr= oc =3D  c.prepareCall("{ ? =3D call fetch_call_logs() }");
 &n= bsp;         c.setAutoCommit(false);&nbs= p;
           proc.registe= rOutParameter(1, java.sql.Types.OTHER);
      &= nbsp;      proc.execute();
    =          ResultSet rset2 =3D (Resul= tSet) proc
           =           .getObject(1);
&n= bsp;  =0A          &= nbsp;  =0A while (rset2.next()) {
     &nb= sp;            =   System.out.println(rset2
       &nb= sp;            =     .getString(1));
       =            }
 &nb= sp;             = ;  rset2.close();
         =        // c.setAutoCommit(false);
 &n= bsp;            &nbs= p;  proc.close();
         =         c.close();

but=0A i m= a not able to get proper response back... if i comment out the fetch=0A sta= tement and tried doing some static update i am able to get proper =0Arespon= se back. Stucked up with this...
I want to open a ref cursor with selec= t for update and then update the records and get the ref cursor in response= back in java.
But=0A its not happening .... if i return ref cursor only= after select it =0Aworks fine but after fetch when i am returning the resp= onse back i am =0Anot getting..
Where am I doing the mistake or anythi= ng I am missing???? Please help me with the same ... it would be very helpf= ul.....


---221098236-106204446-1393911321=:81761--