<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.5" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Explicit Cursors are Dead - Long live the Implicit Cursor</title>
	<link>http://blog.oraclecontractors.com/?p=130</link>
	<description>Oracle Blog from OracleContractors.com</description>
	<pubDate>Tue, 07 Sep 2010 23:31:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>

	<item>
		<title>by: IT Experts Central &#187; Blog Archive &#187; Explicit Cursors Versus Implicit Cursors - IT Experts Central</title>
		<link>http://blog.oraclecontractors.com/?p=130#comment-11958</link>
		<pubDate>Sun, 24 Jun 2007 09:16:13 +0000</pubDate>
		<guid>http://blog.oraclecontractors.com/?p=130#comment-11958</guid>
					<description>[...] There are a lot of discussions in Oracle experts which is better between explicit cursor and implicit cursor. In Oracle Contractors, implicit cursors are sometimes recommended by Tom Kyte of Oracle Magazine&#8217;s &#8216;Ask Tom&#8217; in contrary to Steven Feuerstein teaching that explicit cursors were the most efficient way of retrieving Data. Eddie Awads explained that implicit cursors will make the program shorter yielding the same result. On the other side of the river bank, Andrew Clarke believes that Explicit Cursor is the way to go. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] There are a lot of discussions in Oracle experts which is better between explicit cursor and implicit cursor. In Oracle Contractors, implicit cursors are sometimes recommended by Tom Kyte of Oracle Magazine&#8217;s &#8216;Ask Tom&#8217; in contrary to Steven Feuerstein teaching that explicit cursors were the most efficient way of retrieving Data. Eddie Awads explained that implicit cursors will make the program shorter yielding the same result. On the other side of the river bank, Andrew Clarke believes that Explicit Cursor is the way to go. [&#8230;]
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: William Robertson</title>
		<link>http://blog.oraclecontractors.com/?p=130#comment-52</link>
		<pubDate>Thu, 25 Jan 2007 19:55:32 +0000</pubDate>
		<guid>http://blog.oraclecontractors.com/?p=130#comment-52</guid>
					<description>&#62; and as you mentioned they used to be faster to retrieve data than implicit cursors. That has now changed with the later database releases...

No, it was only ever in Forms that there was an extra network round trip, and that was in the days when everyone coded SELECT FROM DUAL all over the place anyway. I don't think anyone has shown there was ever an inherent advantage to explicit cursors in stored PL/SQL (though possibly that is unfair since nobody has 7.0 around to test on any more).

I think 9i changed everything for PL/SQL. The extensions to the SQL language made it possible to so much more in set operations that the world of Cursor FOR loops seems to belong to an earlier century ;)</description>
		<content:encoded><![CDATA[<p>&gt; and as you mentioned they used to be faster to retrieve data than implicit cursors. That has now changed with the later database releases&#8230;</p>
<p>No, it was only ever in Forms that there was an extra network round trip, and that was in the days when everyone coded SELECT FROM DUAL all over the place anyway. I don&#8217;t think anyone has shown there was ever an inherent advantage to explicit cursors in stored PL/SQL (though possibly that is unfair since nobody has 7.0 around to test on any more).</p>
<p>I think 9i changed everything for PL/SQL. The extensions to the SQL language made it possible to so much more in set operations that the world of Cursor FOR loops seems to belong to an earlier century <img src='http://blog.oraclecontractors.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Patrick Wolf</title>
		<link>http://blog.oraclecontractors.com/?p=130#comment-46</link>
		<pubDate>Wed, 24 Jan 2007 19:07:45 +0000</pubDate>
		<guid>http://blog.oraclecontractors.com/?p=130#comment-46</guid>
					<description>Hi Paul/Misbah,

why should I have to write a different exception handler when I use a implicit cursor compared to an explicit cursor? The only exception handler I could think of would be a NO_DATA_FOUND, but I think it will be the same amount of code for an explicit cursor, because there I have to write an IF cursor%NOTFOUND THEN.

About handling TOO_MANY_ROWS, I think each time you write a SQL statement (also for explicit cursors) where you don't use the PK or a unique key to access your data you have to think about what should happen in case if multiple rows are found. In your case above if you don't care you can add ROWNUM=1 to your sql statement. In the other cases it's good that an exception is raised, because you program/data is wrong and it would maybe work with wrong data if it just uses the first row.

Patrick</description>
		<content:encoded><![CDATA[<p>Hi Paul/Misbah,</p>
<p>why should I have to write a different exception handler when I use a implicit cursor compared to an explicit cursor? The only exception handler I could think of would be a NO_DATA_FOUND, but I think it will be the same amount of code for an explicit cursor, because there I have to write an IF cursor%NOTFOUND THEN.</p>
<p>About handling TOO_MANY_ROWS, I think each time you write a SQL statement (also for explicit cursors) where you don&#8217;t use the PK or a unique key to access your data you have to think about what should happen in case if multiple rows are found. In your case above if you don&#8217;t care you can add ROWNUM=1 to your sql statement. In the other cases it&#8217;s good that an exception is raised, because you program/data is wrong and it would maybe work with wrong data if it just uses the first row.</p>
<p>Patrick
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Paul Driver</title>
		<link>http://blog.oraclecontractors.com/?p=130#comment-41</link>
		<pubDate>Tue, 23 Jan 2007 19:23:27 +0000</pubDate>
		<guid>http://blog.oraclecontractors.com/?p=130#comment-41</guid>
					<description>Misbah

Like you I also use explicit cursors in preference to implicit, and as you mentioned they used to be faster to retrieve data than implicit cursors.  That has now changed with the later database releases and it seems implicit cursors are quicker than explicit ones.  However I'm not convinced that they are easier to write than emplicit ones - once you have added all the error handling required.  

Let me give an example, the other day I had a problem with an implicit cursor which failed on the "when others" exception handler. In short the HRMS lookup, GB_BANKS, the cursor was based on had two seeded rows for the Bank of Scotland bank. The implicit cursor exception handler did not check for the "too many rows" exception so hit the "when others" exception and errored.  When I re-coded this cursor as a explicit cursor the duplicate rows will not be a problem, all I needed was to confirm the bank names existence.

That incident highlights the importance of including all possible exceptions that may be raised by the implicit cursor, even if they seem unlikely to occur. The explicit cursor does not require all this extra coding so, despite the speed handicap I still use them!</description>
		<content:encoded><![CDATA[<p>Misbah</p>
<p>Like you I also use explicit cursors in preference to implicit, and as you mentioned they used to be faster to retrieve data than implicit cursors.  That has now changed with the later database releases and it seems implicit cursors are quicker than explicit ones.  However I&#8217;m not convinced that they are easier to write than emplicit ones - once you have added all the error handling required.  </p>
<p>Let me give an example, the other day I had a problem with an implicit cursor which failed on the &#8220;when others&#8221; exception handler. In short the HRMS lookup, GB_BANKS, the cursor was based on had two seeded rows for the Bank of Scotland bank. The implicit cursor exception handler did not check for the &#8220;too many rows&#8221; exception so hit the &#8220;when others&#8221; exception and errored.  When I re-coded this cursor as a explicit cursor the duplicate rows will not be a problem, all I needed was to confirm the bank names existence.</p>
<p>That incident highlights the importance of including all possible exceptions that may be raised by the implicit cursor, even if they seem unlikely to occur. The explicit cursor does not require all this extra coding so, despite the speed handicap I still use them!
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
