<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://james.newtonking.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>James Newton-King : SQL</title><link>http://james.newtonking.com/archive/tags/SQL/default.aspx</link><description>Tags: SQL</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Oracle Peeves</title><link>http://james.newtonking.com/archive/2006/08/27/Oracle-Peeves.aspx</link><pubDate>Sun, 27 Aug 2006 08:09:00 GMT</pubDate><guid isPermaLink="false">bce7ef4a-1ab4-4a64-ae34-bb54d1362c7e:874</guid><dc:creator>James Newton-King</dc:creator><slash:comments>53</slash:comments><comments>http://james.newtonking.com/archive/2006/08/27/Oracle-Peeves.aspx#comments</comments><description>&lt;p&gt;&lt;img height="19" src="http://www.newtonsoft.com/images/blog/oracle.png" style="width:154px;height:19px;" width="154" /&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;m changing jobs soon and after nearly 3 years of working with Oracle, and little chance of my using it in the near future, I&amp;#39;d like to share (vent) some of my top Oracle peeves.&lt;/p&gt;&lt;p&gt;I&amp;#39;d like to state up front that I don&amp;#39;t &lt;a href="http://thedailywtf.com/ShowForum.aspx?ForumID=17" target="_blank"&gt;hate Oracle&lt;/a&gt;, and I haven&amp;#39;t had enough experience with other databases to know exactly how good or bad Oracle is in comparison.&amp;nbsp;These are just some little things (hopefully &lt;a href="http://www.rittman.net/archives/2006/04/top_ten_things_i_hate_about_th.html" target="_blank"&gt;valid&lt;/a&gt;) that have irked me over the years &lt;img src="http://www.newtonsoft.com/blog/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;30 character name limits&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;m not a fan of &lt;a href="http://en.wikipedia.org/wiki/Hungarian_notation" target="_blank"&gt;Hungarian notation&lt;/a&gt; or most abbreviations (we spend far more time reading code than writing it so any time saved typing will be lost deciphering, besides auto-complete anyone?) so Oracles 30 character limit on names has annoyed me to no end. It usually isn&amp;#39;t a problem with table or column names but when you have a foreign key naming standard that is comprised of the table the key is coming from and going to, things start to get hairy:&lt;/p&gt;&lt;p&gt;E_S_SEC_E_PROC_SUB_TYPE_FK1 &lt;img src="http://www.newtonsoft.com/blog/emoticons/emotion-40.gif" alt="Hmm" /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;select * from dual&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1562813956388" target="_blank"&gt;Why Oracle why?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;To be honest I&amp;#39;ve always found the dual table kind of facinating although Oracle&amp;#39;s limitation does make some do &lt;a href="http://oracle-wtf.blogspot.com/2006/03/create-your-own-dual-table.html" target="_blank"&gt;crazy things&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;SQL statements automatically handling no_data_found&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;In PL/SQL when you want to populate a variable with a value from a table you use &amp;quot;select into&amp;quot;. The select into statement has to return one row. If none are returned then you get a no_data_found exception.&amp;nbsp;If more than one is returned then you get an aptly named too_many_rows exception. Sound fairly simple? The gotcha is that if the exception is thrown by a function being used inside a SQL statement then it is automatically caught. The hows and whys of this behavior confused the bejesus out of me until I came across this &lt;a href="http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:10321465390114#10326465506637" target="_blank"&gt;Ask Tom question&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Varchar2&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;A&amp;nbsp;general grab-bag of aggravating issues around strings in Oracle:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Apparently Oracle promotes the use of varchar2, rather than varchar,&amp;nbsp;because it wants to avoid problems if the SQL standard is ever changed so that possible new varchar behavior doesn&amp;#39;t cause bugs in existing code. DBAs are big on backwards compatibility so a change like that seems a pretty big if to me. Personally I think Oracle should have just stuck with varchar. If the standard ever changed in a way that caused bugs with existing code either used a database flag to turn it on or off or at that point introduce a varchar2 with the new behavior.&lt;/li&gt;&lt;li&gt;By default the length on a varchar2 column specifies byte length, not the number of characters. Most commonly used English text is single byte but it can be a bug lying in waiting if you are unaware of it.&lt;/li&gt;&lt;li&gt;Empty strings are considered null. &amp;#39;&amp;#39; = &amp;#39;&amp;#39;? Not in Oracle!&lt;/li&gt;&lt;li&gt;The string concatenation operator in Oracle is ||. Yuck. To be fair to Oracle this is the operator specified in the ANSI SQL standard.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Memory Usage&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Oracle likes it&amp;#39;s RAM. Having a dedicated database machine (at least if you&amp;#39;re writing, running and debugging .NET applications from Visual Studio) is pretty much compulsory. Oracle having Java embedded inside it can&amp;#39;t help.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Select Into&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;In PL/SQL you can&amp;#39;t use the result from a select in an expression. Instead you have to declare the variable, select into the variable (don&amp;#39;t forget no_data_found and too_many_rows error handling!) and only then use the variable in an if test or whatever. Painful.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Package Headers&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Packages are a Good Thing&amp;trade; and I have a feeling I&amp;#39;ll miss them in SQL Server land but separate headers to control external visibility is so 1990. Having to modify the header signature along with the body is annoying.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Declaring all variables at the top of a procedure/function&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Woah.&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Sixth_Form_Certificate" target="_blank"&gt;Sixth Form Certificate&lt;/a&gt; programming class &lt;a href="http://en.wikipedia.org/wiki/Pascal_programming_language" target="_blank"&gt;Pascal&lt;/a&gt; flashback.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;img align="right" height="90" src="http://www.newtonsoft.com/images/blog/suse.png" style="width:124px;height:90px;" width="124" /&gt;Installing Oracle on Linux&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;10g or 9i? R1 or R2? x86 or x86-64? Redhat Enterprise Linux, Fedora Core, SUSE Enterprise Linux or something else?&lt;/p&gt;&lt;p&gt;There are a lot of permutations and luckily for you there are &lt;a href="http://www.oracle.com/technology/tech/linux/install/index.html" target="_blank"&gt;instructions for all of them&lt;/a&gt; because Oracle installs on each of them differently. Hurrah!&lt;/p&gt;&lt;p&gt;When you do find the guide you are looking for don&amp;#39;t worry, you are halfway there! Only &lt;a href="http://www.puschitz.com/InstallingOracle10g.shtml" target="_blank"&gt;21 pages of instructions&lt;/a&gt; to follow...&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Oracle .NET client size&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;209 megabytes. Compressed.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;To be fair to Oracle,&amp;nbsp;its quirks and WTFs can&amp;#39;t compare with the &lt;a href="http://oracle-wtf.blogspot.com/" target="_blank"&gt;silly things&lt;/a&gt; some developers do with it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://james.newtonking.com/aggbug.aspx?PostID=874" width="1" height="1"&gt;</description><category domain="http://james.newtonking.com/archive/tags/SQL/default.aspx">SQL</category></item></channel></rss>