SQL%ROWCOUNT includes counts from subqueries?
From: Thomas Gagne <TandGandGAGNE_at_gmail.com>
Date: Wed, 02 Jun 2010 22:14:45 -0400
Message-ID: <t-ydnYjgm8-HjZrRnZ2dnUVZ_hednZ2d_at_wow.com>
I have an update statement that if run by itself updates 14 rows, but when I test the value of SQL%ROWCOUNT it's value is 28.
Date: Wed, 02 Jun 2010 22:14:45 -0400
Message-ID: <t-ydnYjgm8-HjZrRnZ2dnUVZ_hednZ2d_at_wow.com>
I have an update statement that if run by itself updates 14 rows, but when I test the value of SQL%ROWCOUNT it's value is 28.
I'm wondering if SQL%ROWCOUNT is counting both the rows found in a subquery as well as the rows updated by the subquery.
Basically
update tablex
set (col1, col2, col3) = (select /* correlated subquery */ ) where tablex.id in (select /* 14 ids from tablex */ )
14 rows updated
(but SQL%ROWCOUNT = 28!)
-- Visit<http://it.toolbox.com/blogs/anything-worth-doing/> for more great reading.Received on Wed Jun 02 2010 - 21:14:45 CDT