Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> SQL%ROWCOUNT with update statement

SQL%ROWCOUNT with update statement

From: Koivu, Lisa <lkoivu_at_qode.com>
Date: Mon, 18 Dec 2000 14:40:30 -0500
Message-Id: <10714.124860@fatcity.com>


This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.

------_=_NextPart_001_01C0692A.63E19066
Content-Type: text/plain;

        charset="iso-8859-1"

Hello all,

One of the developers here is having trouble using this cursor attribute. He swears up and down the statement is correct and should be updating rows. I tried to recreate his problem and wasn't able to. Below is an example of the type of code I'm referencing.

Has anyone ever seen the implicit cursor attributes screw up and return wrong values? I don't believe I ever have. Any responses are appreciated.

Thanks

SQL> l
  1 declare
  2 ln_rowcount NUMBER;
  3 ln_dummy DATE;
  4 BEGIN
  5 UPDATE BIN_LIST
  6 SET LAST_MOD_TMSTMP = SYSDATE;
  7 LN_ROWCOUNT := SQL%ROWCOUNT;
  8 DBMS_OUTPUT.PUT_LINE(ln_rowcount);
  9 COMMIT;
 10 LN_ROWCOUNT := SQL%ROWCOUNT;
 11 DBMS_OUTPUT.PUT_LINE(ln_rowcount);
 12
 13 select sysdate into ln_dummy from dual;  14 LN_ROWCOUNT := SQL%ROWCOUNT;
 15 DBMS_OUTPUT.PUT_LINE(ln_rowcount);
 16
 17
 18* END;
SQL> /
3062
3062
1

PL/SQL procedure successfully completed.

SQL> Lisa Rutland Koivu
Oracle Database Administrator
Qode.com
4850 North State Road 7
Suite G104
Fort Lauderdale, FL 33319

V: 954.484.3191, x174
F: 954.484.2933 
C: 954.658.5849

http://www.qode.com

"The information contained herein does not express the opinion or position of Qode.com and cannot be attributed to or made binding upon Qode.com."

------_=_NextPart_001_01C0692A.63E19066
Content-Type: text/html;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>SQL%ROWCOUNT with update statement</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2 FACE=3D"Arial">Hello all, </FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">One of the developers here is having =
trouble using this cursor attribute.&nbsp; He swears up and down the = statement is correct and should be updating rows.&nbsp; I tried to = recreate his problem and wasn't able to.&nbsp; Below is an example of = the type of code I'm referencing. </FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Has anyone ever seen the implicit =
cursor attributes screw up and return wrong values?&nbsp; I don't = believe I ever have.&nbsp; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Any responses are appreciated. =
</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Thanks</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">SQL&gt; l</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 1&nbsp; declare</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 2&nbsp; ln_rowcount =
NUMBER;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 3&nbsp; ln_dummy =
DATE;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 4&nbsp; BEGIN</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 5&nbsp; UPDATE =
BIN_LIST</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 6&nbsp; SET =
LAST_MOD_TMSTMP =3D SYSDATE;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 7&nbsp; LN_ROWCOUNT :=3D =
SQL%ROWCOUNT;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 8&nbsp; =
DBMS_OUTPUT.PUT_LINE(ln_rowcount);</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp; 9&nbsp; COMMIT;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;10&nbsp; LN_ROWCOUNT :=3D =
SQL%ROWCOUNT;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;11&nbsp; =
DBMS_OUTPUT.PUT_LINE(ln_rowcount);</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;12</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;13&nbsp; select sysdate =
into ln_dummy from dual;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;14&nbsp; LN_ROWCOUNT :=3D =
SQL%ROWCOUNT;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;15&nbsp; =
DBMS_OUTPUT.PUT_LINE(ln_rowcount);</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;16</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;17</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">&nbsp;18* END;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">SQL&gt; /</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">3062</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">3062</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">1</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">PL/SQL procedure successfully =
completed.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">SQL&gt;</FONT>=20
</P>

<P><B><FONT SIZE=3D1 FACE=3D"Arial">Lisa Rutland Koivu</FONT></B>
<BR><FONT SIZE=3D1 FACE=3D"Arial">Oracle Database Administrator</FONT>
<BR><FONT SIZE=3D1 FACE=3D"Arial">Qode.com</FONT>
<BR><FONT SIZE=3D1 FACE=3D"Arial">4850 North State Road 7</FONT>
<BR><FONT SIZE=3D1 FACE=3D"Arial">Suite G104</FONT>
<BR><FONT SIZE=3D1 FACE=3D"Arial">Fort Lauderdale, FL&nbsp; =
33319</FONT>
</P>

<P><FONT SIZE=3D1 FACE=3D"Arial">V: 954.484.3191, x174</FONT>
<BR><FONT SIZE=3D1 FACE=3D"Arial">F: 954.484.2933 </FONT>
<BR><FONT SIZE=3D1 FACE=3D"Arial">C: 954.658.5849</FONT>
<BR><FONT SIZE=3D1 FACE=3D"Arial"><A HREF=3D"http://www.qode.com" =
TARGET=3D"_blank">http://www.qode.com</A></FONT>
</P>

<P><I><FONT COLOR=3D"#000000" SIZE=3D1 FACE=3D"Arial">&quot;The =
information contained herein does not express the opinion or position = Received on Mon Dec 18 2000 - 13:40:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US