<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-13265058</id><updated>2012-01-28T16:56:44.725+11:00</updated><category term='interval'/><category term='non-oracle'/><category term='teradata'/><category term='apex'/><category term='beer'/><category term='proxy'/><category term='postgres'/><category term='meetup'/><category term='SQL'/><category term='autonomous transaction'/><category term='debugging'/><category term='characters'/><category term='books'/><category term='concat'/><category term='Amazon'/><category term='passwords'/><category term='UI'/><category term='sql developer'/><category term='analytics'/><category term='gdal'/><category term='Spatial'/><category term='oracle-xe'/><category term='oralce'/><category term='insert'/><category term='XE'/><category term='presentation'/><category term='OpenStreetMap'/><category term='exceptions'/><category term='troubleshooting'/><category term='Personal Edition'/><category term='job'/><category term='excel'/><category term='exception handling'/><category term='direct-path'/><category term='11gR2'/><category term='ORM'/><category term='Log Buffer'/><category term='11g'/><category term='virtual'/><category term='developer'/><category term='subtype'/><category term='football'/><category term='raid'/><category term='odtug'/><category term='htmldb'/><category term='rant'/><category term='laptop'/><category term='backup'/><category term='humor'/><category term='plsql'/><category term='append'/><category term='technology summit'/><category term='plsql challenge'/><category term='emacs'/><category term='shapefile'/><category term='ogr2ogr'/><category term='servererror'/><category term='sydney'/><category term='to'/><category term='soccer'/><category term='mysql'/><category term='google maps'/><category term='oradbpedia'/><category term='security'/><category term='politics'/><category term='broadband'/><category term='dba'/><category term='optimizer'/><category term='humour'/><category term='XML'/><category term='timesten'/><category term='CSV'/><category term='proxy authentication'/><category term='cloud'/><category term='constructors'/><category term='sylk'/><category term='sql server'/><category term='multimedia'/><category term='oracle'/><category term='rownum'/><category term='AWS'/><category term='databases'/><category term='copyright'/><category term='named notation'/><category term='OTN'/><category term='data structures'/><category term='failsafe'/><category term='testing'/><category term='blogging'/><category term='OSM'/><category term='google'/><category term='SaxLoader'/><title type='text'>Sydney Oracle Lab</title><subtitle type='html'>I am a proud Oracle developer and this is my blog. &lt;br&gt;
My website is  
&lt;a href="http://www.sydoracle.com/"&gt; here&lt;/a&gt; 
&lt;br&gt;

This blog is OPINION, SUGGESTION and DEBATE. 
Please correct anything I write that is misleading.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default?start-index=101&amp;max-results=100'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>220</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-13265058.post-2229769488326211644</id><published>2012-01-08T16:55:00.000+11:00</published><updated>2012-01-08T16:56:23.332+11:00</updated><title type='text'>Crazy Crossovers</title><content type='html'>&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span style="background-color: white; line-height: 18px;"&gt;Some months back, when it was in a 99c special offer, I added "&lt;a href="http://www.amazon.com/Pride-Prejudice-Zombies-Classic-Ultraviolent/dp/1594743347"&gt;Pride and Prejudice and Zombies&lt;/a&gt;" to my book collection. If you haven't heard of it,&amp;nbsp;Seth Grahame-Smith took most of Jane Austen's work (by now in the public domain) and added a zombie subplot.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br style="background-color: white; line-height: 18px;" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span style="background-color: white; line-height: 18px;"&gt;Then about a month back, one of Google Plus's more popular contributors,&lt;/span&gt;&lt;span style="background-color: white; line-height: 18px;"&gt;&lt;a href="https://plus.google.com/u/0/109139639454066616071/about"&gt;Tessie L'Amour&lt;/a&gt;,&amp;nbsp;offered up the option of personalizing her (NSFW) books so that the purchaser could pick the names of the protagonists. That idea isn't new as I recall my parent getting me a personalised book when I was young. It involved a wizard who enjoyed peanut butter and had a magic sunflower. See, these things can stick with you !&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br style="background-color: white; line-height: 18px;" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white; font-family: 'Trebuchet MS', sans-serif; line-height: 18px;"&gt;Wanting to experiment with some &lt;a href="http://googleappsdeveloper.blogspot.com/2011/10/4-ways-to-do-mail-merge-using-google.html"&gt;Google Apps Mail Merging&lt;/a&gt;, I borrowed both concepts. Following the guide, what came out was a &lt;a href="http://www.sydoracle.com/sherlock-gets-personal"&gt;web-form&lt;/a&gt;&amp;nbsp;where you can enter the desired first and last names, plus an email address, and you get a personalised PDF of the first of the Sherlock Holmes short stories, "A Scandal in Bohemia". &lt;i&gt;A google search quickly found &lt;a href="http://www.firebox.com/product/2693/Personalised-Classic-Novels?aff=512&amp;amp;awc=550_1326001855_2e099b61a226fe387b8fac7bce9f7239"&gt;similar personalisation of other classic works&lt;/a&gt;.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white; font-family: 'Trebuchet MS', sans-serif; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif; line-height: 18px;"&gt;This is the story where Sherlock meets the only woman he truly respects. The personalisation relates to the name of the woman (Irene Adler in the original), rather than Sherlock or Watson. I'd prefer an actual ebook format, but that looks a lot trickier. I've settled for sizing the PDF as A5 which makes it readable on my Kindle.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif; line-height: 18px;"&gt;I haven't (yet) included the original Sidney Paget pictures, though I suspect they will also be in the public domain by now. That may happen in future, but work beckons for tomorrow.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, sans-serif; font-size: x-small;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2229769488326211644?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2229769488326211644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2229769488326211644' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2229769488326211644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2229769488326211644'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2012/01/crazy-crossovers.html' title='Crazy Crossovers'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4185462055515547832</id><published>2012-01-04T20:29:00.000+11:00</published><updated>2012-01-04T20:29:17.655+11:00</updated><title type='text'>Playing with Google Plus</title><content type='html'>&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;It's a Christmas break for me and I've been reviewing my social networking&amp;nbsp;commitments.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;I started by thinning RSS Feeds and Twitter load.&amp;nbsp;My main problem with Twitter was a lot of my subscriptions were US based and the timezone meant a poor fit for me. The feed often overflowed overnight, and relatively little would come up during the day.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;I'm shifting more to Google Plus. My initial experience echoes the "Quiet here, isn't it" which I saw mentioned a lot in the media. Luckily after persisting for a few days, I found some shared circles to import, and later someone else shared a circle with me of 500 Aussies.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;This is the first failing of Google Plus - unless you are following someone when they share a circle, you will miss it. That makes it hard to find a decent starting point.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;I have found Google Plus much more like Twitter than Facebook. If Facebook friends are people I'd invite over for dinner, Twitter and Google Plus contacts are a wider group of people I'd chat with in a&amp;nbsp;restaurant&amp;nbsp;or a pub.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Circles are a useful way to group people to read, similar to Twitter lists. For example, I have circles of writers, of Australians, of techies etc. They &lt;i&gt;can&lt;/i&gt; be useful in distributing some material to a limited audience, but I'd recommend posting most things to Public. There are items I'll only post to my Australian or Techie circles if I think it would 'pollute' my public flow with information that most people would find irrelevant.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;If there are some people I want to hear everything from, I put them in a specific circle and I can read everything in that circle. 'Noisy' individuals will go into a circle where I don't mind missing posts.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br class="Apple-interchange-newline" /&gt;&lt;/span&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;Google Plus has a couple advantages over Twitter.&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Firstly, comments are attached to a post which allows for a conversation to develop. I don't find Twitter conversations as usable (but maybe that's my client). In Twitter, I get a few disjointed messages if I don't follow everyone who is chatting, but I can see everyone who comments on a Plus post.&amp;nbsp;&lt;i&gt;Another failing of Google Plus is that when you re-share another person's post, it is hard for the recipient to get back to the original. As such, they'll tend to comment on the shared post not the original.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;By the way, when you comment on a post, you can't see who the post was shared with. That means you don't know who can see your comment. When in doubt, assume it is visible to everyone, including your boss, wife and mother.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Secondly, there's no 140 character limit. The posts can be fuller and include images and video. With Twitter, sometimes I get redirected through half a dozen URL shorteners to see a cartoon I read through someone else the day before.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;My gut feel is that Twitter has more to worry about from Google Plus than Facebook.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Migration from Twitter has few barriers. It wouldn't be hard for a client to integrate tweets into a Google Plus stream. It will be easy to pull out a list of who an individual follows for that integration. It will also be pretty easy to find accounts on Google Plus corresponding to those twitter accounts.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Tweets are ephemeral so no-one expects to maintain history.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Twitter doesn't have features likes games that contribute to the stickiness of Facebook.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;The content will be that bit richer on Google Plus than the forced brevity of Twitter.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Pay a few of the high-profile Tweeters to shift over, and you'll get some major traction. The biggest barrier is probably the 18 age limit on Google Plus, so Twitter might still maintain a place as a 'kiddie channel'.&lt;/span&gt;&lt;div&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Personally, I expect to abandon Twitter in the next 12 months.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;The Minus about Plus&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;There's still a lot that is broken in Google Plus.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;I had a couple of fireworks photos on my phone from New Year's Eve and Android's "Instant Upload" took at least a day and a half.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Sometimes retrieving posts suffers from irritating lags. My guess would be that, even for Google, they still need to work on scaling.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Saying the API is half done would be generous. It doesn't allow posting so that means there are no practical third-party clients, and there's no way of automating posts (eg from an RSS feed). They shouldn't fix that until after they can guarantee the scaling.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;I'm still managing a &lt;a href="https://plus.google.com/u/0/116132019768637593422/about"&gt;primary&lt;/a&gt;&amp;nbsp;and '&lt;a href="https://plus.google.com/u/0/102181347552792364408/about"&gt;Google Apps&lt;/a&gt;' account because the merging is yet to materialize. I've also got a separate page for &lt;a href="https://plus.google.com/u/0/b/117671444215575295808/"&gt;SydOracle&lt;/a&gt; which I will have to think about.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Managing circle membership is cumbersome. It would be nice to have the ability to make some circles as public/shared and for them to show up on a profile.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;To a degree, it is still 'empty'. If your interest if photography or Android, you will be spoilt for choice. Other interests or hobbies may be less well represented.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Suggestions&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;If you are going to join Google Plus (or get deeper into it) I recommend the following :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Share or post a bunch of stuff over a week or so, and make it all Public. That way anyone looking at your posts will get some idea of who you are, what you are interested in etc. Sharing stuff through Google Reader works well for me. Sharing from the browser on my Android phone is less pretty.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Then build up a LONG profile. You can search profiles for key words (or twitter handles etc) so make sure that anyone looking for you can find you.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;When you put someone in your circles, they may put you in theirs. If they push some material only to particular circles, you want them to easily work out which of those might be appropriate for you.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Do some searches on things that interest you. If you find posts that interest you, add the author into an appropriate READ circle. See who they follow, and you may find some more people to add.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;Read up on &lt;a href="http://sociologyplus.com/2011/09/24/section-6-finding-people/"&gt;this&lt;/a&gt; for finding people.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;If someone you have circled seems well-integrated, and your profile has been sufficiently engaging that they have added you, then you can send them the equivalent of a direct-message. Ask them if they have a circle of similar people they can share with you.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br class="Apple-interchange-newline" /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4185462055515547832?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4185462055515547832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4185462055515547832' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4185462055515547832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4185462055515547832'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2012/01/playing-with-google-plus.html' title='Playing with Google Plus'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-1262180843261882218</id><published>2011-12-29T20:14:00.003+11:00</published><updated>2011-12-29T20:16:23.481+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Newsflash - the replacement for the Oracle Support HTML interface will be....HTML</title><content type='html'>Like many other Oracle peeps, I got an email telling me that the current Flash and HTML interfaces for My Oracle Support were to be replaced by a new snazzy ADF based UI.&lt;br /&gt;&lt;br /&gt;What has irked me is the way that some people have implied that the new interface won't be HTML.One example is the &lt;a href="http://oracleinfogram.blogspot.com/2011/12/oracle-priority-service-infogram-for-28.html"&gt;Oracle Infogram ("There's a new version of MOS in the works, not Flash and not HTML")&lt;/a&gt;, though I've seen similar (especially on Twitter which is admittedly constrained by the 140-character limit).&lt;br /&gt;&lt;br /&gt;Let's clarify this. Browsers mostly render HTML (though they deal with straight text, images, maybe video and some other stuff). Through plugins, they can do Flash or Java.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;But the new Oracle UI will be HTML&lt;/b&gt;. HTML spewed by a bunch of App Servers running Java and ADF, true, but still HTML. Going further, if you actually do a 'View Source' in the current HTML support application, right at the top it has&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;i&gt;meta name="generator" content="Oracle ADF Faces"&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I don't know how much, if any, of the ADF layer of the current HTML application is being re-used for the new UI. They may well have done a complete throw-away and rewrite. But it isn't a novel technology stack being used here.&lt;br /&gt;&lt;br /&gt;Maybe this is nit-picky. I just had a horrible feeling that there might be some people out there in Oracle land (and, if I'm being blunt, I don't mean developers) who don't realise that Oracle Forms stuff is an exception and that the main web development paradigm consists of mid-tier code generating HTML (probably with lots of javascript too, but that's a separate issue).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-1262180843261882218?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/1262180843261882218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=1262180843261882218' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1262180843261882218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1262180843261882218'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/12/newsflash-replacement-for-oracle.html' title='Newsflash - the replacement for the Oracle Support HTML interface will be....HTML'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2463138303163616990</id><published>2011-11-26T10:38:00.001+11:00</published><updated>2011-11-26T10:54:38.549+11:00</updated><title type='text'>DBMS_METADATA and hashed passwords</title><content type='html'>In the wonderfully named "&lt;a href="http://oraganism.wordpress.com/"&gt;ORAganism&lt;/a&gt;" blog (don't try oragasm - it is used for something QUITE different)&amp;nbsp;Neil Johnson remarks on the &lt;a href="http://oraganism.wordpress.com/2011/11/23/dbms_metadata-get_ddl-and-select_catalog_role/"&gt;privilege requirements for DBMS_METADATA&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I like DBMS_METADATA. In the old days, you had scripts that tried to re-engineer CREATE scripts from DBA_TABLES and so on. They were complicated and worked in &lt;i&gt;most&lt;/i&gt;&amp;nbsp;situations. DBMS_METADATA is much more powerful.&lt;br /&gt;&lt;br /&gt;One feature worth noting about DBMS_METADATA is that it can also extract details about users which can be handy in the post 11g world of Oracle.&lt;br /&gt;&lt;br /&gt;In 11g the PASSWORD column in the DBA_USERS returns null, rather than hashed version of the user's password as it did in 10g and earlier. That made it a lot harder to extract those password hashes from the database. There is some underlying SYS object that shows the hashes, but SYS objects are really tricky to access.&lt;br /&gt;&lt;br /&gt;DBMS_METADATA gives a backdoor to that information. Not to everyone, but it should be usable by 'regular' DBAs without jumping through hoops.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;select dbms_metadata.get_ddl('USER','GARY') a from dual;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;CREATE USER "GARY" IDENTIFIED BY VALUES 'S:8A9EA7B75F8899D7163336AD9D29F9019C0361518594E6984E1EF1C4EDB8;34BCEDBA9E0AB83F'&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;DEFAULT TABLESPACE "APEX_4875120311438442"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;TEMPORARY TABLESPACE "TEMP"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Before you try to crack my password, don't bother. In my little home environment, it is the same as the username.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2463138303163616990?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2463138303163616990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2463138303163616990' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2463138303163616990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2463138303163616990'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/dbmsmetadata-and-hashed-passwords.html' title='DBMS_METADATA and hashed passwords'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-5206498418893995444</id><published>2011-11-18T19:00:00.000+11:00</published><updated>2011-11-18T19:00:09.193+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Wish List IV - Read only and mean it</title><content type='html'>Did you know that the SELECT privilege actually allows you to do a SELECT ... FOR UPDATE ? Yes, that means a user with just that privilege could lock an entire table.&lt;br /&gt;&lt;br /&gt;I want a SELECT_NOLOCK privilege. The user can still do a SELECT, but they cannot have a lock on the table. Okay, while an SQL is executing, I guess that get the shared table lock. But that's it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-5206498418893995444?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/5206498418893995444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=5206498418893995444' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5206498418893995444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5206498418893995444'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/wish-list-iv-read-only-and-mean-it.html' title='Wish List IV - Read only and mean it'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4027160406071674605</id><published>2011-11-17T19:00:00.000+11:00</published><updated>2011-11-17T19:00:09.067+11:00</updated><title type='text'>Wish List IV - The Whole Truth</title><content type='html'>This is another little annoyance that, I hope, would be a simple change.&lt;br /&gt;&lt;br /&gt;I want a column in USER_TAB_COLUMNS that tells me whether the object is a table or a view. Surely linking off to USER_TABLES to exclude views is an unnecessary burden.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4027160406071674605?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4027160406071674605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4027160406071674605' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4027160406071674605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4027160406071674605'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/wish-list-iv-whole-truth.html' title='Wish List IV - The Whole Truth'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-3242162832752340792</id><published>2011-11-16T19:00:00.000+11:00</published><updated>2011-11-16T19:00:09.282+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Wish List III - The Sequence Cometh</title><content type='html'>This is another of those 'chores' for which every DBA and his dog has a script.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Copy a new version of a table from Test to Dev and then you have to recreate or adjust the associated sequence. My proposed syntax would be&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;ALTER SEQUENCE blah_seq SYNCHRONIZE WITH blah_table (blah_column);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That would lock the table, get the highest value of 'blah_column' and reset the 'last_number' of the sequence to that value. Even better, retain the fact that the sequence has been synchronized with that table/column so there is some metadata about the relationship.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-3242162832752340792?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/3242162832752340792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=3242162832752340792' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3242162832752340792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3242162832752340792'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/wish-list-iii-sequence-cometh.html' title='Wish List III - The Sequence Cometh'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2598191231533120377</id><published>2011-11-15T19:00:00.000+11:00</published><updated>2011-11-15T19:00:00.786+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Wish List II - Ultimate Destruction</title><content type='html'>I'm continuing on my theme of a wish list for 12c (or beyond), and this time I'm taking aim at destroying stuff.&lt;br /&gt;&lt;br /&gt;Juggling development and test areas, every so often it is tempting to wipe the slate clean and start with a fresh schema. The simple way to do that is with a DROP USER blah CASCADE&lt;br /&gt;&lt;br /&gt;It would be nice to have something one step below the 'nuclear' option. I'm thinking&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DROP ALL TABLES UNDER SCHEMA blah&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;plus similar options for dropping sequences, views, procedures, triggers and so on. The user/schema continues to exist, with all their privileges and defaults. But you get to clear out the objects the schema owns.&lt;br /&gt;&lt;br /&gt;Yes, you can script this. The trick is to disable all the referential integrity constraints first, so that you can drop the tables without worrying about the dependencies.&lt;br /&gt;&lt;br /&gt;Cross-schema constraints could still be a problem, as could firing DDL triggers. I'm open to alternative mechanisms. Perhaps DBMS_METADATA could generate a script for dropping objects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2598191231533120377?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2598191231533120377/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2598191231533120377' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2598191231533120377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2598191231533120377'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/wish-list-ii-ultimate-destruction.html' title='Wish List II - Ultimate Destruction'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-5295835351217118870</id><published>2011-11-14T11:53:00.000+11:00</published><updated>2011-11-14T11:53:00.892+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>12c Wishlist - Part 1</title><content type='html'>Last week Nuno posted his '&lt;a href="http://dbasrus.blogspot.com/2011/11/wish-list-for-12c.html"&gt;wish list&lt;/a&gt;' for 12c. Here's the "Number 1" on my list:&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Oracle Personal Edition for Linux.&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.lyrics007.com/Don%20McLean%20Lyrics/American%20Pie%20Lyrics.html"&gt;A long, long time ago...I can still remember&lt;/a&gt;&lt;br /&gt;when Windows was &lt;u&gt;the&lt;/u&gt; OS that ran on the PC on your desk. It made sense that someone running their 'personal' database would just install it natively on that desktop machine, and that meant a Windows install.&lt;br /&gt;&lt;br /&gt;Too often that would just be an install on top of a Standard Operating Environment pre-configured with Office, a virus checker and the other bloat that hangs around. Yuck.&lt;br /&gt;&lt;br /&gt;What I'd like to recommend is that you start with an OS that is&amp;nbsp;stable and decidedly unglamorous, such as&amp;nbsp;RedHat or Oracle Linux. That could run on a commodity x86 under your desk. It could run in a VirtualBox virtual machine on your SOE machine, or in a VMWare or Oracle VM environment managed by real server admins. It could migrate happily between any of them.&lt;br /&gt;&lt;br /&gt;But when I go to the &lt;a href="http://download.oracle.com/docs/cd/E11882_01/license.112/e10594/editions.htm#CJADFHGH"&gt;documentation&lt;/a&gt; I see "&lt;span class="Apple-style-span" style="background-color: white; font-family: Tahoma, sans-serif; font-size: x-small;"&gt;Personal Edition is available on Windows platforms only"&lt;/span&gt;&lt;br /&gt;Oracle are saying go and buy software off Microsoft before you talk to us about running our database ?&lt;br /&gt;&lt;br /&gt;I want Oracle Personal Edition on Linux. Why not a bundle price for the database and Oracle Linux ? You could even sell it as a pre-configured VirtualBox appliance - just add disk. You could 'give away' a one-year Personal Edition licence (cost around $100) with every OCP certification. But push Linux as the preferred platform.&lt;br /&gt;&lt;br /&gt;I'm not sure of the production use cases for Personal Edition. I heard, many years ago, that it had market share in Life Sciences, but it may have since been eclipsed by more specialised solutions, open source RDBMS or NoSQL data stores. Maybe it won't even be offered in 12c, squashed out between Express Edition and MySQL.&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;I've got a few more items on my wish list which I'll post over the coming days. I figured I'd do them as individual posts. In theory that means Plus +1 and retweets might give a guage as to the support for each idea.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-5295835351217118870?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/5295835351217118870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=5295835351217118870' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5295835351217118870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5295835351217118870'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/12c-wishlist-part-1.html' title='12c Wishlist - Part 1'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-135714619958036869</id><published>2011-11-12T19:43:00.001+11:00</published><updated>2011-11-12T20:42:01.276+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>What's the difference</title><content type='html'>I enjoy working with Apex. However one challenge is that it doesn't sit too well with conventional source control systems. Plus the fact that not all organisations use source control systems, especially for the small departmental applications which are a particular sweet spot for Apex.&lt;br /&gt;&lt;br /&gt;One item in my little library of scripts is based on the ApexExport utility. This is part of the main Apex install which you'll probably find on the server. If you don't have access to the server (and some DBAs are understandably cautious about that)&amp;nbsp;&lt;a href="http://krisrice.blogspot.com/2010/10/apex-exportsplitter.html"&gt;ApexExport is also available as part of the Apex Listener&lt;/a&gt;. That's a much more compact download, and I've based my script on that.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.oracle.com/technetwork/developer-tools/apex-listener/downloads/index.html"&gt;Apex Listener&lt;/a&gt;&amp;nbsp;download is a zip file. When you unzip it you get a WAR file. If you unzip the WAR file, you find the "apex.jar" file, which is what you need. If you like playing Russian dolls, you can even unzip the JAR file into the class files, but I don't see the point.&lt;br /&gt;&lt;br /&gt;My &lt;a href="http://www.sydoracle.com/Codespace/diff_apex.zip?attredirects=0&amp;amp;d=1"&gt;Apex diff script&lt;/a&gt; simply extracts the same application (based on the id) from two Apex workspaces and does a compare of the results. This is handy to see if the version in a development workspace is the same as that in Testing/Production (eg has another developer done some work on it).&amp;nbsp;An alternative use case is to ensure that no-one has been sneaking unapproved amendments into Prod.&lt;br /&gt;&lt;br /&gt;My script is a zip because downloading BAT files is often blocked. It is trivially small, so the code is shown below too.&lt;br /&gt;&lt;br /&gt;I've been lazy and hard-coded the username password here. Feel free to replace them with more parameters. Similarly with directory names, and you can replace the MS-DOS "fc" call with one to your favorite diff utility. I've used &lt;a href="http://www.prestosoft.com/edp_examdiff.asp"&gt;ExamDiff&lt;/a&gt; for a long time and my preferred editor, &lt;a href="http://www.pspad.com/"&gt;PsPad&lt;/a&gt;&amp;nbsp;has one built in as well.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;REM&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;REM Usage "diff JDBC_conn1 JDBC_conn2 nnnn"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;REM&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;REM Note: Use JDBC connection format 127.0.0.1:1521:xe&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;REM&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;del f%3_1.sql&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;del f%3_2.sql&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;cd G:\oracleXE_11\apex_listener\WEB-INF\lib&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;set CLASSPATH=%CLASSPATH%;.\;.\ojdbc6.jar;.\apex.jar&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;java oracle.dbtools.apex.utilities.APEXExport -db %1 -user gary -password gary -application %3&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;rename f%3.sql f%3_1.sql&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;java oracle.dbtools.apex.utilities.APEXExport -db %2 -user gary -password gary -application %3&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;rename f%3.sql f%3_2.sql&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;fc /c /l /n /w f%3_1.sql f%3_2.sql&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-135714619958036869?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/135714619958036869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=135714619958036869' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/135714619958036869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/135714619958036869'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/whats-difference.html' title='What&apos;s the difference'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-6984509211899977356</id><published>2011-11-05T09:03:00.000+11:00</published><updated>2011-11-05T09:03:03.949+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>How to prevent your SQL Developer sessions from being killed</title><content type='html'>&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;A while back I worked on a site where the network would terminate connections that were idle too long (around 20-30 minutes). It is pretty frustrating when you've been working on something for a while then you go grab a coffee or have a meeting and come back to find the connection had been killed.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;It was even more frustrating when the session was still alive in the database and had to be killed there, so that it could rollback the work so that it could be repeated all over again.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;What I'd like is a SQL Developer feature that would periodically send a lightweight request over to the database so the connection is kept alive. Alas, the powers that be seem &lt;a href="http://www.thatjeffsmith.com/archive/2011/10/day-1-give-me-a-keep-alive-button/"&gt;averse to providing&lt;/a&gt; such a function.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;I also accept that there are &lt;a href="http://en.wikipedia.org/wiki/Confirmation_bias"&gt;barriers&lt;/a&gt;&amp;nbsp;in trying to get people to&amp;nbsp;&lt;a href="http://youarenotsosmart.com/2011/06/10/the-backfire-effect/"&gt;change&lt;/a&gt; their &lt;a href="http://www.cracked.com/article_19468_5-logical-fallacies-that-make-you-wrong-more-than-you-think.html"&gt;opinions&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The good news is that SQL Developer has the concept of &lt;a href="http://krisrice.blogspot.com/2006/11/getting-started-with-extension.html"&gt;extensions&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;If something you want is too specialised to be included by Oracle themselves, or they haven't got around to it or simply don't want to do it, then an extension can help.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;In this case, a bloke called MinChen Chai has published an &lt;a href="https://sites.google.com/site/keepaliveext/"&gt;extension to add KeepAlive&lt;/a&gt; functionality to SQL Developer.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Just download it and add the .jar to the directory &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sqldeveloper\sqldeveloper\extensions&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt; and the Right-click menu on a connection will include a Keep-Alive item.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;If you want to be on the cautious side, you can use unzip or similar to extract the class files from the JAR file. Then you can use the &lt;a href="http://java.decompiler.free.fr/"&gt;Java Decompiler&lt;/a&gt;&amp;nbsp;(or similar) and view the source from the class files. The SQL used is in the Pinger.class and is a pretty inoffensive SELECT SYSDATE FROM DUAL.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Warning : I haven't tested to see if it works if you spawn out an unshared worksheet.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;If your environment is locked down to prevent extensions being added, then all I can suggest is a User-Defined Report with a refresh set to the maximum delay. Unfortunately this &lt;a href="https://forums.oracle.com/forums/thread.jspa?threadID=1084796"&gt;grabs focus in Windows&lt;/a&gt;&amp;nbsp;and the maximum delay is just two minutes which is much too frequent in my opinion, but it is hard coded. As an aside, the 'reports' component also sits in the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;extensions directory&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;(oracle.sqldeveloper.report.jar).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;u&gt;Should we be doing this ?&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;I accept there are situations where it is appropriate for a DBA to terminate sessions. And this won't stop an explicit ALTER SYSTEM KILL SESSION. &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;However I think terminating sessions automatically based on 'being idle' is something that is abnormal, and is inappropriate for most environments. &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Before terminating a session, several factors should be considered. These include&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Is the session actually doing something important - like the monthly pay cheques&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Is the session blocking other sessions (and which session is more vital to the business)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Is there a need to preserve session state (PL/SQL global variables, temporary tables etc)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Is there an active transaction&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Can the transaction be (safely) committed&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;How much rollback would need to be applied if it is killed&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Is the session consuming lots of memory&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Can the user/client cope gracefully with a failure&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;If your DBA doesn't consider such factors and is happy to terminate sessions without worrying about the effect, then you have a problem. You'll just have to g&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;rin and bear it and hope that that there's some form of karma.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;It may help to read a DBA's blog post about a &lt;a href="http://openquery.com/blog/what-hosting-provider-did-today"&gt;hosting provider admin deleting some of his log files&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;I love the comments that "anything with 'log' in the name is by convention disposable but useful for diagnosis" and "Log files do build up and unless there is meaningful data in them you can remove them."&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-6984509211899977356?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/6984509211899977356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=6984509211899977356' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6984509211899977356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6984509211899977356'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/11/how-to-prevent-your-sql-developer.html' title='How to prevent your SQL Developer sessions from being killed'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-7689453935826296514</id><published>2011-10-31T23:42:00.002+11:00</published><updated>2011-11-01T08:28:37.390+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>A short story about death</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;Let me tell you about an application I worked with some time ago.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;It is an 'intranet' application. The application is just used within an organisation, though the database it runs against is also used by public web applications too.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;Unusually for a web application, it doesn't use a connection pool. Users log in and a dedicated connection is spawned. And if they do certain operations, those also get a dedicated connection.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;None of those connections is allowed to be idle for more than 25 minutes. Every five minutes, a house keeping job comes along and kills off any connections that are idle for more than 20 minutes.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;On the face of it, that is a resource saving measure. Otherwise all those idle connections would pile up and kill the server. But actually it isn't. If you look at the 'life' of a session, it spends a few minutes being active, then sits around for 20 minutes doing nothing before being killed. In fact most of the sessions on the database are idle, waiting for their death sentence to be actioned.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;If it wasn't for that house-keeping job, someone would have come along and actually fixed the source of the problem. That is, after the operation is complete, the session would be disconnected by the application. Or the logout button on the application would actually do something - like log out of the application.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;It is like keeping the shower running after you get out, then coming back ten minutes later to turn it off so as to not waste water.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;The best time to end a session is immediately after it stops doing useful work. If you choose to implement a '&lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6010.htm"&gt;kill if idle&lt;/a&gt;' option, you are saying it is okay for resources to be wasted for the period up until you decide it has been 'too idle'. Sometimes it is - it may be too difficult or expensive to fix the source of the problem.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;But don't pretend this is the most efficient mechanism to manage resources.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;Bought to you by my "&lt;a href="http://www.thatjeffsmith.com/archive/2011/10/day-1-give-me-a-keep-alive-button/#comment-12863"&gt;Campaign for the Humane Treatment of Database Sessions&lt;/a&gt;'&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-7689453935826296514?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/7689453935826296514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=7689453935826296514' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7689453935826296514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7689453935826296514'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/10/short-story-about-death.html' title='A short story about death'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-1491118287579217189</id><published>2011-10-11T07:00:00.000+11:00</published><updated>2011-10-11T07:00:02.802+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>An underhand compilation</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Oracle cheats. Or, more generously, it sometimes plays by different rules. Normally a DDL will do an implicit commit of any outstanding transaction. Actually it does a couple of implicit commits, one before it tries the DDL and a second if it succeeds.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Furthermore, an 'ALTER PACKAGE .. COMPILE' is a DDL statement. And it does an implicit commit.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;However, if the compilation occurs implicitly, because you are trying to execute a package that it is invalid, then your outstanding transaction ISN'T committed. That is what you want as your application can't cope with having partial transactions committed just because it needs to compile a package.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The question really is, if the commit isn't actually necessary, is it being performed by the ALTER PACKAGE simply to be consistent ?&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Demo script follows:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; DROP TABLE plch_data PURGE;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; CREATE TABLE plch_data&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp;(id NUMBER, col_a NUMBER, col_b NUMBER);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; CREATE OR REPLACE PACKAGE plch_pkg&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp;IS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; FUNCTION ret_count RETURN NUMBER;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 4 &amp;nbsp;END plch_pkg;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 5 &amp;nbsp;/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; CREATE OR REPLACE PACKAGE BODY plch_pkg&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp;IS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 3 &amp;nbsp; FUNCTION ret_count RETURN NUMBER IS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp; v_num NUMBER;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 5 &amp;nbsp; BEGIN&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp; SELECT COUNT(id) INTO v_num&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; FROM plch_data;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp; --&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 9 &amp;nbsp; &amp;nbsp; RETURN v_num;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp;10 &amp;nbsp; END ret_count;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp;11 &amp;nbsp;END plch_pkg;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp;12 &amp;nbsp;/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; SELECT object_name, object_type, status&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp;FROM user_objects&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 3 &amp;nbsp;WHERE object_name = 'PLCH_PKG';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;OBJECT_NAM OBJECT_TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STATUS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;---------- ------------------- -------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE BODY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; ALTER TABLE plch_data DROP COLUMN id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; ALTER TABLE plch_data RENAME COLUMN col_a TO id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; SELECT object_name, object_type, status&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp;FROM user_objects&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 3 &amp;nbsp;WHERE object_name = 'PLCH_PKG';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;OBJECT_NAM OBJECT_TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STATUS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;---------- ------------------- -------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE BODY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INVALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; INSERT INTO plch_data (id) VALUES (10);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; EXEC dbms_output.PUT_LINE( plch_pkg.ret_count);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; ROLLBACK;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; EXEC dbms_output.PUT_LINE( plch_pkg.ret_count);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; REM =================================================================&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; ALTER TABLE plch_data DROP COLUMN id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; ALTER TABLE plch_data RENAME COLUMN col_b TO id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; SELECT object_name, object_type, status&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp;FROM user_objects&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 3 &amp;nbsp;WHERE object_name = 'PLCH_PKG';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;OBJECT_NAM OBJECT_TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STATUS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;---------- ------------------- -------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE BODY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INVALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; INSERT INTO plch_data (id) VALUES (10);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; ALTER PACKAGE PLCH_PKG COMPILE BODY;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; SELECT object_name, object_type, status&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp;FROM user_objects&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 3 &amp;nbsp;WHERE object_name = 'PLCH_PKG';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;OBJECT_NAM OBJECT_TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STATUS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;---------- ------------------- -------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;PLCH_PKG &amp;nbsp; PACKAGE BODY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VALID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; EXEC dbms_output.PUT_LINE( plch_pkg.ret_count);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; ROLLBACK;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;XE&amp;gt; EXEC dbms_output.PUT_LINE( plch_pkg.ret_count);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-1491118287579217189?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/1491118287579217189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=1491118287579217189' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1491118287579217189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1491118287579217189'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/10/underhand-compilation.html' title='An underhand compilation'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2088354658139645067</id><published>2011-10-08T07:00:00.000+11:00</published><updated>2011-10-08T07:00:00.313+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>It's Enterprise and won't be cheap....</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Most of OOW seemed to be about Boxes, the bigger the better.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;I'm not a DBA. The people at Pythian are, and they've said nice things about the Appliance. I think it suits their business model, which is external DBA support. If a company already has good DBAs and listens to them, it shouldn't fare too badly on getting the correct hardware setup. If it doesn't have good DBAs (or it doesn't listen to them), then it probably won't hear about the appliance, and they'll end up with some commodity kit (maybe running MySQL or even SQL Server).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The Exalytics machines is way out of my field. It is probably good. It is probably expensive. It is probably something I won't get my hands on.&amp;nbsp;The same goes for the rest of this Big Data stuff. Clusters of scores of machines are expensive.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;We do have a nice NoSQL solution. I'll probably download that to play with, but it is something that is really for Java developers (or some of these newer languages that get fashionable every couple of years). I think I'll have to re-title myself as a 'Relational Database Developer'.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;So the 'cloud' bit was the part that appealed most. Not the Fusion Apps stuff. Its nice that it is finally out there, but that isn't my field either.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;a href="https://twitter.com/#!/guyharrison"&gt;Guy Harrison's tweets&lt;/a&gt; have included some nuggets "&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: rgba(47, 194, 239, 0.0976563); color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 15px; line-height: 19px;"&gt;DB cloud service will not support direct SQL from outside oracle public cloud - stateless REST calls only."&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;and&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: rgba(47, 194, 239, 0.0976563); color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 15px; line-height: 19px;"&gt;&amp;nbsp;"&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: rgba(47, 194, 239, 0.0976563); color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 15px; line-height: 19px;"&gt;DB cloud service gives you a schema in a shared DB, not a whole instance like Amazon RDS. More like SQL azure than RDS"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Pricing won't be cheap. This is Enterprise Edition folks. It's not for startups trying to run a business on pizza, coke and little white pills. It is for people with big pockets.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;a href="http://roelhartman.blogspot.com/2011/10/oow2011-announcing-sql-developer-31-new.html"&gt;Roel Hartman&lt;/a&gt;&amp;nbsp;indicates that&amp;nbsp;SQL Developer 3.1 will have some special sauce that will allow you to connect to these cloudy databases. I think the twitter-stream has a screen shot, but I've lost it. [Twitter was in turbo mode the past few days - unfortunate for us down under where a lot of the action happens while we are in bed.]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Other IDEs may need to do some catching up to work with those databases. I'd also suspect that it might prove a barrier to any applications not running on Oracle's cloud too. While Java (and other JVM languages ?) might be doable, I wonder whether Forms will make the cut.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Application Express seems to be making its presence felt. Though after Larry aired his views on Salesforce, I wonder whether the "apex" name will become a battleground as a "cloud language". &lt;i&gt;Hey folks, the appex.com domain name appears vacant at the moment&lt;/i&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Oh yes, the Social Network thing. My last company used Yammer, which was pretty similar to what Salesforce offers with Chatter, and the company I'm working at now has something similar. Yes they have a Facebook 'feel', but the focus is 'employer' related. People will have both and won't have a problem keeping them separate, mostly because your employer 'owns' one and all your friends who work elsewhere won't be there.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2088354658139645067?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2088354658139645067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2088354658139645067' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2088354658139645067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2088354658139645067'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/10/its-enterprise-and-wont-be-cheap.html' title='It&apos;s Enterprise and won&apos;t be cheap....'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2465382983622799499</id><published>2011-10-07T20:44:00.002+11:00</published><updated>2011-10-07T21:09:17.584+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>One head, plus one body (slightly damaged)</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;We all know that two heads are better than one. Apparently a head without a body can be more useful than one with a broken body.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This train of thought was prompted by an &lt;a href="http://plsqlchallenge.com/pls/apex/f?p=10000:651:1342880733484828::NO:651:P651_COMP_EVENT_ID,P651_QUIZ_ID:7205,7985&amp;amp;cs=195AC1D42A55610F69D8A5FB02A1360A6"&gt;interesting question&lt;/a&gt; on the &lt;a href="http://www.plsqlchallenge.com/"&gt;PL/SQL Challenge&lt;/a&gt; earlier this week (October 6, 2011 - to be precise). The question posed the puzzle about what happens when you reference a constant defined in the specification of a PL/SQL package if there was an invalid body.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;My initial thought was that it is quite valid to have a package specification without a body, and you can safely references types and constants in that specification. I incorrectly assumed that an invalid body wouldn't be a problem.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;One reason why it fails is that a body can contain an initialisation section. That is you can have:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;CREATE OR REPLACE PACKAGE plch_pkg&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;IS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;g_stuff &amp;nbsp; VARCHAR2 (10) := 'Stuff';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;PROCEDURE show_dummy;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;END plch_pkg;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;CREATE OR REPLACE PACKAGE BODY plch_pkg&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;IS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;PROCEDURE show_dummy&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;IS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;BEGIN&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DBMS_OUTPUT.put_line ('Dummy');&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;END;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;b&gt;BEGIN&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;b&gt;&amp;nbsp; dbms_output.put_line('Start it up');&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;END plch_pkg;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;exec dbms_output.put_line(plch_pkg.g_stuff);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This would output both "Start it up" and "Stuff". But of course it can only do that if the body is valid and can be executed by Oracle, which is why Oracle has to try to recompile an invalid package body and must throw an error if it fails.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2465382983622799499?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2465382983622799499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2465382983622799499' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2465382983622799499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2465382983622799499'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/10/one-head-plus-one-body-slightly-damaged.html' title='One head, plus one body (slightly damaged)'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-6422699689992480037</id><published>2011-09-18T08:30:00.001+10:00</published><updated>2011-10-07T21:09:45.926+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Laying down the law over warnings</title><content type='html'>&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;a href="http://www.oracle-base.com/"&gt;Tim&lt;/a&gt;&amp;nbsp;commented on yesterday's post by saying "I&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&amp;nbsp;would not be overly disturbed if Oracle made this clause [DEFINER/INVOKER RIGHTS] mandatory in future."&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;With such a broad range of software that runs against Oracle, some of it from third party vendors, I don't see Oracle making changes that would break existing applications.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;But they could and have allowed for you to make it mandatory yourself. Perhaps they even make it so in their internal development.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;Start with a simple procedure:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;create or replace procedure do_it is&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;begin&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&amp;nbsp; &amp;nbsp;dbms_output.put_line('Humbug');&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;end do_it;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;If we compile it with all the warnings enabled, we get the "Missing AUTHID clause" warning.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;XE&amp;gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;alter session set plsql_warnings='ENABLE:ALL';&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;XE&amp;gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;alter procedure do_it compile;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444; font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444; font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SP2-0805: Procedure altered with compilation warnings&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444; font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;XE&amp;gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;select text, attribute from user_errors where name = 'DO_IT';&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444; font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;TEXT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ATTRIBUTE&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;-------------------------------------------------------------------------------- ---------&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;PLW-05018: unit DO_IT omitted optional AUTHID clause; default value DEFINER used &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;u&gt;WARNING&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;XE&amp;gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;exec do_it&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #444444; font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Humbug&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: small; line-height: 18px;"&gt;But we can use the PLSQL_WARNINGS setting to make enforcement more "&lt;a href="http://en.wikipedia.org/wiki/Judge_Dredd"&gt;Judge Dredd&lt;/a&gt;".&lt;/div&gt;&lt;div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: small; line-height: 18px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;XE&amp;gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;alter procedure do_it compile plsql_warnings='ENABLE:ALL','ERROR:05018';&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small; line-height: 18px;"&gt;Warning: Procedure altered with compilation errors.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;XE&amp;gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;select text, attribute from user_errors where name = 'DO_IT';&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: xx-small; line-height: 18px;"&gt;TEXT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ATTRIBUTE&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;-------------------------------------------------------------------------------- ---------&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;PLS-05018: unit DO_IT omitted optional AUTHID clause; default value DEFINER used &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;u&gt;ERROR&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;XE&amp;gt; exec do_it&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;BEGIN do_it; END;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small; line-height: 18px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; *&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;ERROR at line 1:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;ORA-06550: line 1, column 7:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;PLS-00905: object GARY.DO_IT is invalid&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;ORA-06550: line 1, column 7:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;PL/SQL: Statement ignored&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;Rather than just enabling the warning, we can treat it as an error, effectively making the clause mandatory in our environment. Obviously it doesn't make sense for this particular warning to be set at the program unit level. It might make sense for other warnings to be set as errors at the schema or database level, and then individual overrides can be set for exceptional program units.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-6422699689992480037?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/6422699689992480037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=6422699689992480037' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6422699689992480037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6422699689992480037'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/09/laying-down-law-over-warnings.html' title='Laying down the law over warnings'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-3374707734037145843</id><published>2011-09-17T19:23:00.000+10:00</published><updated>2011-10-07T21:10:05.933+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>WARNING, WARNING, DANGER, DANGER !</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Yes, the catch-cry from the "Lost in Space" Robot. But I'm more interested in PL/SQL Warnings.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;My new contract is working with an Oracle 11gR2 database. [Aside: It's great using up-to-date versions and with the new 11.2.0.2 version of XE, it's almost like Christmas.]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;With new versions come new features and several new PL/SQL compiler warnings have been added to 11gR2. One of those is "&lt;span class="Apple-style-span" style="background-color: #f2f2f5;"&gt;&lt;span style="zoom: 1;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;PLW-05018: unit &amp;lt;program unit&amp;gt; omitted optional AUTHID clause; default value DEFINER used&lt;/b&gt;&lt;/span&gt;"&lt;/span&gt;&lt;span style="zoom: 1;"&gt;. This message&amp;nbsp;&lt;/span&gt;&lt;/span&gt;was described by Steven Feuerstein as "&lt;span class="Apple-style-span" style="background-color: #f2f2f5;"&gt;one of those "nuisance" warnings that will pop up on almost every one of our compiles, because so few developers use AUTHID (for invoker rights) and legacy code certainly does not include this clause"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This description was in the answer to one of the &lt;a href="http://plsql-challenge.blogspot.com/2011/07/objections-to-plsql-warnings-quiz-in-q2.html"&gt;Championship playoff questions&lt;/a&gt; which asked players to look at some code and give the number of warnings that it would generate. Most players underestimated the answer, partly because the number of warnings is going up with each version.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;For most developers this warning is pretty much superfluous. It is pretty rare to be developing DEFINER rights code for applications. However utilities and some of the built-in schemas (eg MDSYS etc) might have elevated privileges and exposing that power through a procedure is something that needs careful consideration.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;It is possible to enable and disable specific warnings.&amp;nbsp;Personally I use the fine-grained option available on the command line through ALTER SESSION.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ALTER SESSION SET PLSQL_WARNINGS= &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; 'ENABLE:ALL','DISABLE:07203'&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;,&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'DISABLE:05018',&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'DISABLE:06009'&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The DBAs can set these using ALTER SYSTEM, or might set up LOGON triggers on specific schemas to set appropriate values. You may also want a different level of warnings in your development databases that your testing and production databases.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;It may also be possible to set your preferred options in your IDE. However looking at "SQL Developer", the options in the GUI to enable/disable these warnings are pretty coarse-grained, so I wouldn't recommend this solution.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-tHC0HUKGGGY/TnRJl2gkPQI/AAAAAAAAABg/dHeGe7iJHVk/s1600/plsql_warning.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="286" src="http://4.bp.blogspot.com/-tHC0HUKGGGY/TnRJl2gkPQI/AAAAAAAAABg/dHeGe7iJHVk/s400/plsql_warning.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;SQL Developer options for setting PL/SQL Warnings&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Another location for defining the PLSQL_WARNINGS level is on the object itself.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; create or replace procedure do_it (i_text IN OUT VARCHAR) is&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 2 &amp;nbsp;begin&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp;dbms_output.put_line(i_text);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 4 &amp;nbsp;end do_it;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; 5 &amp;nbsp;/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; alter session set plsql_warnings='ENABLE:ALL';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Session altered.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; alter procedure do_it compile;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;SP2-0805: Procedure altered with compilation warnings&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;XE&amp;gt; select text from user_errors where name = 'DO_IT';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;TEXT&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;PLW-07203: parameter 'I_TEXT' may benefit from use of the NOCOPY compiler hint&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;PLW-05018: unit DO_IT omitted optional AUTHID clause; default value DEFINER used&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This simple procedure gives two errors when all warnings are enabled. If I then recompile it with those warnings disabled, it comes out clean.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;XE&amp;gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;alter procedure do_it compile plsql_warnings='ENABLE:ALL','DISABLE:07203','DISABLE:05018';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Procedure altered.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;XE&amp;gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;select text from user_errors where name = 'DO_IT';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;no rows selected&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;If I do a straight compile on that procedure afterwards, it will use the current session settings (which will be inherited from the system settings if not set specifically).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;XE&amp;gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;alter procedure do_it compile;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;SP2-0805: Procedure altered with compilation warnings&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;XE&amp;gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;select text from user_errors where name = 'DO_IT';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;TEXT&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;--------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;PLW-07203: parameter 'I_TEXT' may benefit from use of the NOCOPY compiler hint&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;PLW-05018: unit DO_IT omitted optional AUTHID clause; default value DEFINER used&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;However you can specify 'REUSE SETTINGS' so that the explicitly define settings are retained.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;XE&amp;gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;alter procedure do_it compile plsql_warnings='ENABLE:ALL','DISABLE:07203','DISABLE:05018';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Procedure altered.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;XE&amp;gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;alter procedure do_it compile reuse settings;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Procedure altered.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;XE&amp;gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;select text from user_errors where name = 'DO_IT';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;no rows selected&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;My recommendations would be for the development environment to have at least some warnings enabled, either at the system level or for specific schemas. Then, if individual modules need differing settings, these can be specified and retained (assuming your IDE is up to the job).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;For testing environments, having warnings enabled might be a useful step as this may be the first 'independent' compilation of the code. A second set of eyes reviewing the warnings could be a basic 'code review'.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;I don't see a benefit in warnings in production environments. But I don't see a real downside either.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-3374707734037145843?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/3374707734037145843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=3374707734037145843' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3374707734037145843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3374707734037145843'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/09/warning-warning-danger-danger.html' title='WARNING, WARNING, DANGER, DANGER !'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-tHC0HUKGGGY/TnRJl2gkPQI/AAAAAAAAABg/dHeGe7iJHVk/s72-c/plsql_warning.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-3209942497048158547</id><published>2011-09-02T11:55:00.003+10:00</published><updated>2011-09-02T11:55:58.902+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle-xe'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Oracle 11gR2 Express Edition is FREE</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;I've just wiped my Oracle XE 10g Edition on my home PC and replaced it with a fresh clean &lt;a href="http://www.oracle.com/technetwork/database/express-edition/overview/index.html"&gt;11g Express Edition&lt;/a&gt;.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;For those who haven't met XE before, it is the free edition of Oracle.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;It allows for up to 11Gb of data (up from 4Gb in the old XE) and will use 1 CPU and 1 GB of RAM. The server can have more power, but it won't get used by the database.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;You can use it for free (developing, testing, running production applications and even give training using it).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;You don't get some of the snazzy Enterprise Edition features. No FLASHBACK DATABASE or FLASHBACK TABLE. No PL/SQL Function Result Cache. No Diagnostic or Tuning packs. Or table compression.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The big 'Standard Edition' feature I can see that is missing is Java in the database.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;It comes with Apex 4.0 pre-installed.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-3209942497048158547?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/3209942497048158547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=3209942497048158547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3209942497048158547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3209942497048158547'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/09/oracle-11gr2-express-edition-is-free.html' title='Oracle 11gR2 Express Edition is FREE'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-6203795929317995520</id><published>2011-08-31T10:09:00.003+10:00</published><updated>2011-08-31T10:39:03.239+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><title type='text'>Swapping the white shirt for a towel ?</title><content type='html'>&lt;span class="Apple-style-span" &gt;For almost three years I have been a consultant. Dark suit, white shirt, tie. The official uniform of the 'You can trust us' brigade. [Aside, I was reading &lt;a href="http://freakonomicsbook.com/"&gt;Superfreakonomics&lt;/a&gt; recently and learned that &lt;a href="http://www.telegraph.co.uk/news/uknews/1511031/The-deadly-germs-nestling-in-your-tie.html"&gt;ties are often germ ridden&lt;/a&gt; so the soon we all stop wearing them, the better!]&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Next week I start a new job. Back to contract work, with a role doing Application Express development. Yeah ! I do like Apex. I'd previously &lt;a href="http://blog.sydoracle.com/2011/01/of-architects-astronauts-and-engineers.html"&gt;remarked&lt;/a&gt; about the feeling of accomplishment I get when building code. It is nice to see something you've built being used. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I'm contracting through an agency (&lt;a href="http://www.bsipeople.com/"&gt;BSIPeople&lt;/a&gt;) who supplied me with a snazzy Sports Bag on sign up. The bag contained the ubiquitous pen, a hat, a drink bottle and a towel. My wife's reaction to the towel was an immediate reference to the &lt;a href="http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy#Knowing_where_one.27s_towel_is"&gt;Hitchhikers Guide to the Galaxy&lt;/a&gt;. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;"&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px; background-color: rgb(255, 255, 255); "&gt;any man who can hitch the length and breadth of the galaxy, rough it, slum it, struggle against terrible odds, win through, and still knows where his towel is, is clearly a man to be reckoned with"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; line-height: 19px; background-color: rgb(255, 255, 255); "&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; line-height: 19px; background-color: rgb(255, 255, 255); "&gt;&lt;span class="Apple-style-span" &gt;There's something appropriate about going back to contracting armed with a towel. I'm looking forward to it.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-6203795929317995520?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/6203795929317995520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=6203795929317995520' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6203795929317995520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6203795929317995520'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/08/swapping-white-shirt-for-towel.html' title='Swapping the white shirt for a towel ?'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2133719552174770854</id><published>2011-08-28T08:05:00.004+10:00</published><updated>2011-08-28T08:19:20.728+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><title type='text'>Canadian dogs on drugs</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" &gt;This is what happens when you get your data model wrong.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I subscribe to RISKS digests, and the latest issue has an interesting &lt;a href="http://catless.ncl.ac.uk/Risks/26.54.html#subj3"&gt;post&lt;/a&gt; on a poor Canadian bloke who got confused with his dog.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;The dog was on some prescription medicine. Dogs can't go into the local pharmacy and buy this stuff themselves, so the owner performed this duty. The drug purchase/pickup got entered into the nationwide recording system against the purchaser's name.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;The problem comes when this guy goes into hospital and that purchase shows up on his records. There's no indication that the drugs are actually intended for a different recipient (Cooper the dog) so the doctors didn't know this. Fortunately the owner was conscious and lucid and able to tell the doctor that he wasn't on those drugs and the mixup got sorted.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;It is perfectly reasonable to have a pharmacy record that doctors in hospitals can easily refer to so that they can find out what medications a patient is on. My dad takes various pills for things, and i'd be pretty sure he won't remember the individual names. Plus they deal with accidents and cases where the patient may be unconscious  or unable to talk.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I suspect they've also started to use the same pharmacy records to pick up people who buy too much of particular drugs. Here in Oz they've gone as far as to stop selling various cold remedies whose ingredients were used in making illegal drugs. So drug purchases for pets get thrown into the same bit bucket.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;The problem is that corruption of the data model, of the meaning of the data, has impacted the primary purpose of the system. Keep your data clean folks&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2133719552174770854?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2133719552174770854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2133719552174770854' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2133719552174770854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2133719552174770854'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/08/canadian-dogs-on-drugs.html' title='Canadian dogs on drugs'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-7636750154116986218</id><published>2011-08-21T14:29:00.003+10:00</published><updated>2011-08-21T15:26:18.973+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Redo log buffer or redo log file ?</title><content type='html'>&lt;span class="Apple-style-span" &gt;There's a very interesting post on Jonathan Lewis' blog under the unassuming title of &lt;a href="http://jonathanlewis.wordpress.com/2011/08/19/redo-2/"&gt;REDO&lt;/a&gt;.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Oracle treats a transaction as committed when the change and the commit has been written to the redo log BUFFER and doesn't require it to be written to the redo log FILE. &lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;This can cause issues if the instance fails before that log data is flushed to the the file. If the disk write fails BECAUSE the instance fails, it is very unlikely that anything would have had a chance to look at the data in that tiny gap (but even rare risks WILL happen somewhere, sometime). If the disk write fails but the instance continues for a time (which is simulated in Jonathan's post) then the risk gets higher.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I think RAC throws a few more variables in there. Conceivably, a transaction in one instance may have committed data (not written to redo log file) shunted to another instance where it can be amended again and written to that instance's redo log file. If that first instance fails without a persistent copy of that initial transaction, then it can never be re-applied in its entirety.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;But then I'm a developer and maybe I'm missing something in the the way instance recoveries are managed in RAC.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;So is Oracle 'broken' ? &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;One problem is the notion of 'durability' is vague. A committed action should last beyond 'system failure', but in a 'cheap' system the CPU and disks can be in the same rack (or the same server) and a failure, such as a fire, could destroy both. Does that mean a transaction shouldn't be viewed as 'committed' until the log file is archived and shipped elsewhere ? Conversely, an expensive 'Data Guard' architecture with a maximum &lt;a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28294/protection.htm"&gt;protection mode/level&lt;/a&gt; might not be impacted by the failure of a redo log write on a single node.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I suspect this one will run on for a while, and it is worth keeping an eye on Jonathan's post as the experts weigh in.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-7636750154116986218?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/7636750154116986218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=7636750154116986218' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7636750154116986218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7636750154116986218'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/08/redo-log-buffer-or-redo-log-file.html' title='Redo log buffer or redo log file ?'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-5528512293836864155</id><published>2011-08-19T14:00:00.003+10:00</published><updated>2011-08-19T14:00:04.153+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>The casino approach to security</title><content type='html'>&lt;span class="Apple-style-span" &gt;We can learn a lot from casinos. At least that's &lt;a href="http://tacticalwebappsec.blogspot.com/2009/07/lessons-learned-from-casino.html"&gt;one view on application security&lt;/a&gt;. The rules have changed from being a case of what is allowed versus what isn't allowed, to something a bit fuzzier.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;As an example, on my way to the Sydney Oracle Meetup 'Expert' event I had a phone call from my bank. Apparently my credit card had just been rejected in a Australia Post office as a suspect transaction. Since I'd been on the train it wasn't me. The card was in my wallet too, so it hadn't been nicked. The card had been skimmed somewhere.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;The suspect transaction wasn't above my credit limit. It's not like I've never used it in an Australia Post either (though never for the amount involved). It may have been an odd location, but I hadn't had any rejections on a recent holiday. In short, it probably wasn't any single factor that tripped the security wire, rather a whole set of criteria that marked it as suspect. &lt;i&gt;Okay, maybe it came down to a suspicious employee of Australia Post, but this is a database blog not an episode of Law and Order.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span"&gt;There's a careful balancing act the bank has to perform (and it did it very well in this case). It has to, in the words of the article, "&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-size: 13px; font-weight: bold; line-height: 18px; background-color: rgb(255, 255, 255); "&gt;let the people play". &lt;/span&gt;&lt;span class="Apple-style-span"&gt; It can't stop every credit card transaction, but has to look for rogue behavior. Its not something I've directly worked in, but I've done fuzzy algorithms for data matching. You add some points for one fact, a few more for another and at the end you get a resulting numeric value for 'how likely'. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span"&gt;That requires lots of logging of activity, and there's an increasing requirement to analyse these logs, sometimes in real time (or near real time) for those behavioral factors. Hadoop seems to get some mentions for this form of analysis, though I'm sure there are other solutions in the NoSQL wo&lt;/span&gt;&lt;span class="Apple-style-span"&gt;rld. I'm sure &lt;a href="http://voltdb.com/company/blog/why-voltdb-so-fast"&gt;VoltDB&lt;/a&gt; would offer themselves up here too. My gut feel for this style of application would be some form of distributed data store. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;There are rumors of an &lt;a href="http://www.dbms2.com/2011/06/24/forthcoming-oracle-appliances/"&gt;Oracle Hadoop Appliance&lt;/a&gt; which may or not be confirmed in a few weeks at OOW. That said, there have long been rumors of an &lt;a href="http://www.oracle-base.com/blog/2009/09/16/oracle-games-console/"&gt;Oracle Games Console&lt;/a&gt;, and I'm thinking of applying for a trademark for ExaPhone before Larry gets in there. Oracle do have a pedigree of dealing with vast amounts of data (anyone mention CERN ?) so it will be interesting to see how they play out in this area.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-5528512293836864155?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/5528512293836864155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=5528512293836864155' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5528512293836864155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5528512293836864155'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/08/casino-approach-to-security.html' title='The casino approach to security'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2840828670934461001</id><published>2011-08-19T13:02:00.003+10:00</published><updated>2011-08-19T14:01:08.535+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>An evening with some Oracle Experts</title><content type='html'>&lt;span class="Apple-style-span" &gt;This week has been InSync11 week in Sydney. Actually it was Tuesday and Wednesday (though Tom Kyte stuck around afterwards for a 'Day of Real World Performance'). The bad news is that my dollars didn't stretch to any of those events.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;The good news is that it did stretch to the (free) Sydney Oracle Meetup event mentioned by a couple of our guest experts, &lt;a href="http://richardfoote.wordpress.com/2011/08/13/how-to-become-an-oracle-expert-the-scientist/"&gt;Richard Foote&lt;/a&gt; and &lt;a href="http://www.oracle-base.com/blog/2011/08/16/insync11-day-1/"&gt;Tim Hall&lt;/a&gt;. We were able to tempt the experts away to a local RSL club with the promise of alcohol and Oracle users.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Each of the experts got to pick a question to answer from a carefully selected list. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Tim picked out one on the worth of certifications. He's got lots and doesn't think a lot of them. Or rather, as a debate with Marcelle drew out, believes they are limited in the practical benefit of them in the workplace. They do work in exposing areas of new functionality, so that you can think about them. Marcelle is of the opinion that learning to deal with users, developers and managers is more important than learning syntax.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Richard waxed forth on the importance of knowing about indexes. Apparently he doesn't actually spend his working days poring over block dumps and counting blevels. He actually does a lot of normal DBA work and became synonymous with indexes when his &lt;a href="http://richardfoote.wordpress.com/2007/12/11/index-internals-rebuilding-the-truth/"&gt;Rebuilding the Truth&lt;/a&gt; paper went viral, plus a bet about how long he could blog about indexes (and David Bowie).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Marcelle chose the question about dealing with people rejecting an expert's advice. Some of this was drawn from the debate over her paper on &lt;a href="http://foreignkeys.blogspot.com"&gt;Foreign Keys&lt;/a&gt;. Given the rise of the NoSQL / distributed database concepts, and the 'eventual consistency' model, the paper raised some valid points. Equally the advice is irrelevant to many people who are not faced with those problems. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Tom talked about the fear of presenting. Apparently this is best resolved by doing it lots. [&lt;a href="http://apex.oracle.com/pls/otn/f?p=19297:4:3968434487336983::NO:4:P4_ID:207"&gt;Tony Jambu&lt;/a&gt; won the autographed copy of &lt;a href="http://www.amazon.com/Expert-Oracle-Database-Architecture-Programming/dp/1430229462"&gt;Tom's book.&lt;/a&gt; It is impressive when you have an Oracle ACE in the audience.]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Chris Muir talked about his crush on &lt;a href="http://technology.amis.nl/blog/author/lucas"&gt;Lucas Jellema&lt;/a&gt; when answering about his favorite expert. Apparently he is very enthusiastic and it can be contagious. [He didn't actually say "crush", but I find it fun to use since Kellyn talked of her &lt;a href="http://dbakevlar.com/2010/07/dba-crushes/"&gt;DBA Crushes&lt;/a&gt;.]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Connor talked about user groups and how it is fun to be around people who think this database stuff is fun. He also complemented us on the turnout (around 60 - our biggest event so far). Not sure who got the autographed copy of his &lt;a href="http://www.apress.com/catalog/product/view/id/5054/s/9781430234852/category/175/"&gt;book&lt;/a&gt; (or rather the one he did a chapter for) but I'm envious.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Craig picked up a question on social media. The upshot seemed to be that having a social media presence doesn't make you an expert, but it can help your expertise get noticed. A lot of our 'experts' didn't feel quite comfortable under that label. They pointed out that there are a lot of 'quiet experts' out there with excellent experience and knowledge. They just happen to go around talking about it.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;This also came across in Guy's response to how long it takes to become an expert. It isn't really about time. If you do something a lot, you will become good at it, but it reaches a point where it doesn't add any more. Furthermore, with the pace of change in IT, after a couple of years it actually becomes less relevant as it is out-dated.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;There was also some final discussion on balancing Oracle with a 'non-oracle' life , such as family. Apparently it helps if you don't watch Masterchef. It doesn't look easy when lots of travel is required though.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2840828670934461001?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2840828670934461001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2840828670934461001' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2840828670934461001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2840828670934461001'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/08/evening-with-some-oracle-experts.html' title='An evening with some Oracle Experts'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-3961205711442819012</id><published>2011-07-25T19:40:00.001+10:00</published><updated>2011-07-25T19:40:00.796+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='non-oracle'/><title type='text'>Is it just me</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" &gt;I'm thinking about starting a petition against the misuse of Powerpoint. Unusually though, I'm not campaigning against 'Death by Powerpoint' problem (scourge though it is). My campaign is "If it isn't a presentation, it isn't a Powerpoint'. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; "&gt;In a meeting with a colleague last week, he said that he'd put together a few slides for a client meeting next week. I mentioned that previous meetings had been in a room without a projector, so it wasn't likely to be 'presentation-friendly'. I added that he should just use Word. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; "&gt;Apparently though he wasn't expecting to present the material, just use Powerpoint to produce a document.  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; "&gt;The product wasn't going to be a detailed report. It would be a few observations, suggestions and recommendations. Maybe with a couple of diagrams. I suspect it wouldn't be any harder to produce such a document in Powerpoint. It may even be easier. But it gives me the squirms.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Powerpoint is (or should be) are creating slides for a presentation. They don't have to include pretty animations and transitions and there's nothing wrong with being able to print out the presentation for reference. Using it to build something intended as a printed document seems wrong though, like storing a date in a string. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;It is that form of misuse that ensures Microsoft have to allow the use of 8 and 10pt fonts, and default to new slides to streams of bullet points. Things that kill 'real' presentations. Frankly, it turns Powerpoint into a mule. [I'm not sure whether Apple's Keynote suffers the same problem.] &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;And we shouldn't judge a document on the number of pages it has. If you can fit it all on a single page, there's nothing wrong with that. Blowing up the font size to 'Super Large', only fitting three or four sentences to a page and then delivering it in ten pages doesn't help. And it either wastes paper, or you end up printing it two-pages per side of paper and just making it look ugly.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;So save Powerpoint for when you expect to be clicking through the slides, &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;PS.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;a href="http://mwidlake.wordpress.com/2011/07/21/friday-philosophy-powerpoint-picture-pain/"&gt;Martin Widlake&lt;/a&gt; and &lt;a href="http://www.oracle-base.com/blog/2011/07/24/toolbar-buttons-revisited/"&gt;Tim Hall&lt;/a&gt; have both blogged about Powerpoint recently. Martin has been developing his image skills. Apparently gradients fills are more natural. Tim points out that the only time you see a floppy disk these days is on a toolbar icon.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Next week I've got a one-day course on delivering successful presentations. For that I've got to prepare a two minute presentation, so I'll see if I can manage a '2 Minute Application Express'. Will practice that over the next few days, and maybe post it as a webcast.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-3961205711442819012?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/3961205711442819012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=3961205711442819012' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3961205711442819012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3961205711442819012'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/07/is-it-just-me.html' title='Is it just me'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-5426531969422039706</id><published>2011-07-20T19:20:00.002+10:00</published><updated>2011-07-20T19:20:00.537+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Turning it around</title><content type='html'>&lt;span class="Apple-style-span" &gt;I wanted to share an insight into the REVERSE operation inspired by a stackoverflow &lt;a href="http://stackoverflow.com/questions/6751460/reversing-a-string-using-an-index-in-oracle"&gt;question&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;The question was about using the built-in REVERSE function to find the characters at the end of a string. Sticking the REVERSE keywork in the CREATE INDEX statement wasn't doing the job. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; "&gt;Adam Musch responded to say that REVERSE should be used solely to avoid contention and that the optimizer doesn't do range scans on reverse key indexes.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Markus Winand suggested a manual function-based index rather than just using the REVERSE keyword in the CREATE INDEX statement. While that might work sometimes, it isn't a solution I'd recommend.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;With a quick experiment you can see one reason why.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;select 'é', dump('é'), dump(reverse('é')) from dual;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;table summary="" cellpadding="0" cellspacing="0" border="0" class="htmldbMinReport" style="font-family: Arial, Helvetica, Geneva, sans-serif; font-size: 12px; empty-cells: show; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(170, 170, 170); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(170, 170, 170); border-left-color: rgb(170, 170, 170); border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; "&gt;&lt;tbody style="font-size: 12px; "&gt;&lt;tr style="font-size: 12px; "&gt;&lt;th style="font-size: 12px; padding-top: 6px; padding-right: 9px; padding-bottom: 6px; padding-left: 9px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(135, 156, 189); font-weight: bold; border-bottom-width: 1px; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; white-space: nowrap; vertical-align: bottom; color: rgb(255, 255, 255); background-image: url(http://apex.oracle.com/i/apex/reg_top_bg.png); background-position: initial initial; background-repeat: repeat no-repeat; "&gt;'É'&lt;/th&gt;&lt;th style="font-size: 12px; padding-top: 6px; padding-right: 9px; padding-bottom: 6px; padding-left: 9px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(135, 156, 189); font-weight: bold; border-bottom-width: 1px; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; white-space: nowrap; vertical-align: bottom; color: rgb(255, 255, 255); background-image: url(http://apex.oracle.com/i/apex/reg_top_bg.png); background-position: initial initial; background-repeat: repeat no-repeat; "&gt;DUMP('É')&lt;/th&gt;&lt;th style="font-size: 12px; padding-top: 6px; padding-right: 9px; padding-bottom: 6px; padding-left: 9px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(135, 156, 189); font-weight: bold; border-bottom-width: 1px; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; white-space: nowrap; vertical-align: bottom; color: rgb(255, 255, 255); background-image: url(http://apex.oracle.com/i/apex/reg_top_bg.png); background-position: initial initial; background-repeat: repeat no-repeat; "&gt;DUMP(REVERSE('É'))&lt;/th&gt;&lt;/tr&gt;&lt;tr style="font-size: 12px; "&gt;&lt;td style="font-size: 12px; padding-top: 3px; padding-right: 9px; padding-bottom: 3px; padding-left: 9px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(244, 244, 244); border-top-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-bottom-width: 1px; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; empty-cells: show; background-position: initial initial; background-repeat: initial initial; "&gt;é&lt;/td&gt;&lt;td style="font-size: 12px; padding-top: 3px; padding-right: 9px; padding-bottom: 3px; padding-left: 9px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(244, 244, 244); border-top-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-bottom-width: 1px; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; empty-cells: show; background-position: initial initial; background-repeat: initial initial; "&gt;Typ=96 Len=2: 195,169&lt;/td&gt;&lt;td style="font-size: 12px; padding-top: 3px; padding-right: 9px; padding-bottom: 3px; padding-left: 9px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(244, 244, 244); border-top-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-bottom-width: 1px; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; empty-cells: show; background-position: initial initial; background-repeat: initial initial; "&gt;Typ=96 Len=2: 169,195&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;A multi-byte character has the BYTES reversed. As such, the character is not actually preserved and cannot be matched. LIKE, BETWEEN and regular expressions matches against another string (column or literal) become meaningless. The only thing that can be done is to reverse another string and do a direct byte-to-byte comparison. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;That means you might be okay if you do a &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;SELECT * FROM table&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;WHERE reverse(column) LIKE reverse(:var)||'%'&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;Unless you can come up with a failure case....&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-5426531969422039706?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/5426531969422039706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=5426531969422039706' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5426531969422039706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5426531969422039706'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/07/turning-it-around.html' title='Turning it around'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4797227564970808495</id><published>2011-06-30T19:55:00.089+10:00</published><updated>2011-06-30T19:55:00.476+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>More on Checksumming</title><content type='html'>&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;Prompted by a comment I realise that I need to put some more flesh on Checksumming.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;WHY ?&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;A good use case is regression testing. A decent regression test will include a script to set up data so you can execute your task (preferably in an automated manner) and check your actual results match your expected results. That is pretty easy if the expected result is a value returned by a function. When it is a data change, it gets a bit trickier.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;You can set up your expected results in a table (or a set of tables matching your main schema), run the tests and check the actual result data matches the expected result data. That can be as simple as&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;exec comp_tables('TEST_ACTUAL','TEST_EXPECTED');&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;Depending on your testing mechanisms, that can raise an exception if it fails, return an error code or record the results in a table. My example code just dumps it out to DBMS_OUTPUT. Also, a regression test will probably have expected results in several tables, so you'll need multiple comparisons.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;Just to complicate things, often the tables will contain sequence generated ids or use the current date as a 'created / modified date'. So you might want to exclude some columns (or rows) from comparison.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;begin&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;&amp;nbsp; comp_tables(&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;&amp;nbsp; &amp;nbsp;'&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;SELECT val_char, val_number from TEST_ACTUAL WHERE val_char=''ABC''&lt;/span&gt;',&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;&amp;nbsp; &amp;nbsp;'&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;SELECT val_char, val_number from TEST_EXPECTED WHERE val_char=''ABC''&lt;/span&gt;');&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;&lt;b&gt;HOW ?&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;I've uploaded my code to the SydOracle &lt;a href="http://www.sydoracle.com/Codespace"&gt;CodeSpace&lt;/a&gt;&amp;nbsp;location as&amp;nbsp;&lt;a href="http://comp_tables.sql/"&gt;Comp_Tables.sql&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;It works in several steps.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;1. Take the entered query (eg 'SELECT 1 a, 2 b FROM DUAL') and determine the columns.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;2. Create a wrapper query around that. That would give&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;SELECT ora_hash(a) a, ora_hash(b) b&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;FROM (SELECT 1 a, 2 b FROM DUAL)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;The hashes turn all the values (of the main datatypes) into numbers, which makes them easy to aggregate, and comparing aggregated values is easy. The hashing also practically guarantees no collisions. That would give a result set like&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt; &lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/b&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;2342552567&amp;nbsp;&amp;nbsp;&amp;nbsp; 2064090006&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;3. Create another wrapper to mock up a hash for each row.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;SELECT mod(a,100) * mod(b,100) row_hash, h.* FROM&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;&amp;nbsp; (SELECT ora_hash(a) a, ora_hash(b) b&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;&amp;nbsp; &amp;nbsp;FROM (SELECT 1 a, 2 b FROM DUAL)) h&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;Paraphrasing&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/MorecambeAndWise"&gt;Eric Morecombe&lt;/a&gt;, it is fine having all the right columns, but you also want them in all the right order. These results sets will show the same total hashes for columns 'A' and 'B' as the contents of those columns are identical. if you have one row of (1,'A') and a second of (2,'B'), a 'column-only' match would quite happily accept (1,'B') / (2,'A') since all the column values are identical.&lt;/span&gt;&lt;/span&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;By creating another column based on all the values for the entire row, we get a summary of the row. We can't simply add the hashes from the columns together as the sum of all the 'A's plus the sum of all the 'B's is mathematically the same as the sum of the As+Bs. In short, we'd lose the checksumming effect as we aggregate the row values. So I've used multiplication with a MOD so the numbers are unlikely to get too big.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt; &lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;ROW_HASH &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/b&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 402&amp;nbsp; 2342552567&amp;nbsp; 2064090006&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;4. Finally we aggregate the values for all the rows. I've used SUM, though AVG would work just as well (and would give smaller, more manageable values for larger datasets). That gives an SQL like&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;SELECT SUM(row_hash),SUM(a),SUM(b)&lt;br /&gt;FROM (SELECT mod(a,100) * mod(b,100) row_hash, h.* &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM(SELECT ora_hash(a) a, ora_hash(b) b &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM (SELECT rownum a, 2 b&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM DUAL CONNECT BY LEVEL &amp;lt; 5)) h) &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;(I've changed the SQL here to give multiple rows, so you can see the effect of the sum).&lt;br /&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;b&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ROW_HASH&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&lt;/span&gt;&lt;/b&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 402&amp;nbsp;&amp;nbsp; &amp;nbsp;2342552567&amp;nbsp;&amp;nbsp; &amp;nbsp;2064090006&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36&amp;nbsp;&amp;nbsp; &amp;nbsp;2064090006&amp;nbsp;&amp;nbsp; &amp;nbsp;2064090006&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 354&amp;nbsp;&amp;nbsp; &amp;nbsp;2706503459&amp;nbsp;&amp;nbsp; &amp;nbsp;2064090006&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 186&amp;nbsp;&amp;nbsp; &amp;nbsp;3217185531&amp;nbsp;&amp;nbsp; &amp;nbsp;2064090006&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;========================================&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; 978&amp;nbsp;&amp;nbsp; 10330331563&amp;nbsp;&amp;nbsp;&amp;nbsp; 8256360024 &lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;5. That gives us a one record encapsulation of an entire table (or subset of a table).&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;If we do that once for the 'actual' and once for the 'expected' we can compare those two records and see where they match.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;So if we compare the previous SQL with a similar one with a different value from 'B' &lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: 'Courier New',Courier,monospace;"&gt;SELECT SUM(row_hash),SUM(a),SUM(b)&lt;br /&gt;FROM (SELECT mod(a,100) * mod(b,100) row_hash, h.* &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM(SELECT ora_hash(a) a, ora_hash(b) b &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM (SELECT rownum a, 3 b&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="color: blue; font-family: 'Courier New',Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM DUAL CONNECT BY LEVEL &amp;lt; 5)) h)&lt;/span&gt;&lt;div style="font-family: 'Times New Roman';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;b&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ROW_HASH&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&lt;/span&gt;&lt;/b&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9617&amp;nbsp; 10330331563&amp;nbsp; 10826013836&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;In the above example, the final row shows us that column 'A' matches but 'B' does not. We would then investigate the code to find out why 'B' wasn't always being derived as expected.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;u&gt;&lt;b&gt;Caveats&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;While you could just store the aggregate hash of the expected results, that would prevent you drilling down to investigate issues, so I don't recommend it.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;Also, since the code accepts SQLs, you can do exotic things like joins, functions and analytics. Again, I'd recommend against it on the 'Keep It Simple' principle.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;And if you use weird column names (ie mixed or lower case with strange characters that require quoted identifiers) you are on your own. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4797227564970808495?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4797227564970808495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4797227564970808495' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4797227564970808495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4797227564970808495'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/06/more-on-checksumming.html' title='More on Checksumming'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-626171893120889841</id><published>2011-06-28T17:01:00.001+10:00</published><updated>2011-06-28T17:01:02.394+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Check summing a table row</title><content type='html'>&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px;"&gt;Oracle has a built-in package for optimistic locking called&amp;nbsp;&lt;a href="http://download.oracle.com/docs/cd/B14099_19/web.1012/b15896/pslock.htm" rel="nofollow" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #0077cc; cursor: pointer; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;"&gt;OWA_OPT_LOCK&lt;/a&gt;. This can be used to generate a checksum for any row like this:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select owa_opt_lock.checksum('SCOTT','EMP',ROWID)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;from empwhere empno = 123;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px;"&gt;This nugget fell into the bucket of "Things I discovered, but couldn't actually find when I wanted to use it". Then it cropped up as a Stackoverflow &lt;a href="http://stackoverflow.com/questions/6426932/implementing-optimistic-concurrency-on-a-legacy-database"&gt;answer&lt;/a&gt;, so I'm putting it in here so I can find it.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px;"&gt;Apparently it is a very simple &lt;a href="http://www.netfor2.com/checksum.html"&gt;checksum&lt;/a&gt;&amp;nbsp;involving summing up the binary values and inverting it. It isn't a sophisticated hash designed to give low chances of collisions. The code isn't wrapped, so you can have a peek. It seems to do a simple concatenation of the values (implicitly converted to strings), so definitely isn't bulletproof or super-secure. Honestly, it wouldn't have done the job I was attempting when I couldn't find it.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;If you want a simple sanity check that a small table on one database has the same contents as it does on another, then it will generally work okay. But for each call (and therefore each row, if you want it for an entire table's contents), it will do queries against all_tab_columns. So it won't be quick.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; line-height: 18px;"&gt;Anything big, and I'd hack up my own select based on&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 18px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select 'sum(ora_hash('||column_name||')),'&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;from all_tab_columns&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;where table_name = '...'&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;which would also say WHICH columns had differences.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-626171893120889841?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/626171893120889841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=626171893120889841' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/626171893120889841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/626171893120889841'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/06/check-summing-table-row.html' title='Check summing a table row'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-7307967328643583675</id><published>2011-06-22T19:28:00.000+10:00</published><updated>2011-06-22T19:28:41.883+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>The exceptional case of the backwards null</title><content type='html'>&lt;div style="font-family: arial; font-size: small;"&gt;Yes, Virginia, there is a unique NULL. The trick is to go backwards.&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;At my son's school, children in the younger years are buddied up with a child from an older year. Using this as example, I'm going to use the database to ensure that no child is buddied up to more than one other child. If we have an odd number of children, an unlucky one will have no buddy, but if our uniqueness constraint can ensure that there can only be one null, we can make sure we never have more than one 'un-buddied' child.&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span class="Apple-style-span" style="color: #6600cc; font-family: 'courier new', monospace;"&gt;CREATE TABLE child&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;span style="white-space: pre-wrap;"&gt; &lt;/span&gt;(child_id &amp;nbsp; &amp;nbsp; &amp;nbsp;NUMBER NOT NULL,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;span style="white-space: pre-wrap;"&gt; &lt;/span&gt;child_name &amp;nbsp; &amp;nbsp; VARCHAR2(20) NOT NULL,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;span style="white-space: pre-wrap;"&gt; &lt;/span&gt;buddy_id &amp;nbsp; &amp;nbsp; &amp;nbsp; NUMBER,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;span style="white-space: pre-wrap;"&gt; &lt;/span&gt;CONSTRAINT child_pk PRIMARY KEY (child_id)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;span style="white-space: pre-wrap;"&gt; &lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;CREATE UNIQUE INDEX child_uk ON child (buddy_id);&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;insert into child &amp;nbsp;(child_id, child_name)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;values &amp;nbsp;(1,'Adam');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;insert into child &amp;nbsp;(child_id, child_name)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;values &amp;nbsp;(2,'Bill');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;insert into child &amp;nbsp;(child_id, child_name)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;values &amp;nbsp;(3,'Chris');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;update child set buddy_id = 3 where child_id != 3;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;div style="color: black; font-family: 'Times New Roman'; font-size: medium;"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;ERROR at line 1:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;ORA-00001: unique constraint (PERFORM.CHILD_UK) violated&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;The UPDATE fails because of the uniqueness constraint. But it didn't object to multiple NULL values on the INSERTs.&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;Reading the &lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm#sthref6593"&gt;documentation&lt;/a&gt;, we find out that DESC indexes will treat multiple NULLs as duplicates and so will not allow them.&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;Let's give it a try&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;TRUNCATE TABLE child;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;DROP INDEX child_uk;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;CREATE UNIQUE INDEX child_uk ON child (buddy_id DESC);&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span class="Apple-style-span" style="color: #6600cc; font-family: 'courier new', monospace;"&gt;insert into child &amp;nbsp;(child_id, child_name)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;values &amp;nbsp;(1,'Adam');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;insert into child &amp;nbsp;(child_id, child_name)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;span style="color: #6600cc; font-family: 'courier new', monospace;"&gt;values &amp;nbsp;(2,'Bill');&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;ERROR at line 1:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;ORA-00001: unique constraint (PERFORM.CHILD_UK) violated&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;Yup, documented behavious matches actual behaviour.&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;Why ? Well, the DESC index is actually a function-based index using SYS_OP_DESCEND. That takes every byte of the input and subtracts its ascii value from 255. Then it sticks an extra byte of value 255 on the end (so the descending order has 'ABC' coming after 'ABCD'). The NULL gets converted to a single byte with the value 0.&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: arial;"&gt;At least in 10g, the optimizer isn't smart enough to use the index for a '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;WHERE buddy_id IS NULL&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial;"&gt;' predicate, but will for a one with a predicate of &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SYS_OP_DESCEND(buddy_id) =SYS_OP_DESCEND(null)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial; font-size: small;"&gt;PS. I'm not enforcing referential integrity on the buddy_id, so children may end up with imaginary friends. I'm also not enforcing that if Fred's buddy is Barney, then Barney's buddy is Fred. Those are left as an exercise for the reader.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-7307967328643583675?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/7307967328643583675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=7307967328643583675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7307967328643583675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7307967328643583675'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/06/exceptional-case-of-backwards-null.html' title='The exceptional case of the backwards null'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4673616668545646002</id><published>2011-06-20T22:40:00.000+10:00</published><updated>2011-06-20T22:40:53.864+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>SQL Injection and the variable IN list</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Pete Finnegan tweeted a&lt;a href="http://tinkode27.baywords.com/cnn-com-still-vulnerable-to-oracle-sql-injection-after-1-year/"&gt; link&lt;/a&gt; from a guy who discovered an SQL injection vulnerability on the CNN.com website. Actually he discovered it over a&lt;a href="http://isrtinkode.wordpress.com/2010/02/20/cnn-vulnerable-to-sql-injection/"&gt; year&lt;/a&gt; ago, and reported it. And still no-one has got around to fixing it yet.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;It is an Oracle database (apparently 9.2.0.4 - so they're not keeping up with patches either). And not only is there an SQL injection vulnerability, but if the SQL is invalid, it throws the whole statement out to the web-page as part of the error 'handling'.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The vulnerability is in a requirement which gets regular questions on stackoverflow. Specifically, given a string with a list of ids (such as '1,2,3,4'), how do I put that in an 'IN' list.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The problem is thinking in specifics not abstracts. You need to make the mental jump and realize that you are have IN (:variable) not IN (:var1,:var2,:v3).&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;So here's my recommendation for this. Firstly a function that will turn that CSV value into a collection. Here I use the built-in SYS.DBMS_DEBUG_VC2COLL, though it is tidier to create your own collection type.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;create or replace function csv_to_list (i_list in varchar2) return sys.dbms_debug_vc2coll is&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; v_list varchar2(4000) := i_list;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; v_ind number;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; t_list sys.dbms_debug_vc2coll := sys.dbms_debug_vc2coll ();&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;begin&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; v_ind := instr(v_list,',');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; while v_ind &amp;gt; 0 loop&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; t_list.extend;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; t_list(t_list.count) := substr(v_list,1,v_ind-1);&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; v_list := substr(v_list,v_ind + 1);&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; v_ind := instr(v_list,',');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; end loop;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; if v_list is not null then&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; t_list.extend;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; t_list(t_list.count) := v_list;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; end if;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; return t_list;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Next, you take that collection, and turn it into a dataset with the TABLE operator. Finally, you use that as the source for a single-column subquery.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;span class="Apple-style-span" style="color: black; font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;select table_name from user_tables&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;where blocks in&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp; (select column_value from table(csv_to_list('1,2,3,4,5')));&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;Then you can &lt;b&gt;&lt;u&gt;BIND&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&amp;nbsp;the variable rather than concatenating it into a dynamically executed statement.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4673616668545646002?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4673616668545646002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4673616668545646002' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4673616668545646002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4673616668545646002'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/06/sql-injection-and-variable-in-list.html' title='SQL Injection and the variable IN list'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2272996493066612703</id><published>2011-06-03T09:10:00.000+10:00</published><updated>2011-06-03T09:10:15.828+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Locked down in Oracle Amazon RDS</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="SMSNormal"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;a href="" name="_GoBack"&gt;&lt;/a&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;If you dig down into the Oracle on Amazon RDS, you can find the some&amp;nbsp;&lt;a href="http://docs.amazonwebservices.com/AmazonRDS/latest/UserGuide/index.html?Concepts.DBEngine.html"&gt;&lt;span style="color: blue;"&gt;security restrictions&lt;/span&gt;&lt;/a&gt;. These are things that Amazon won't let you do with your database and include the following:&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;  &lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;Alter database&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;Alter system&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;Create any directory&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;Drop any directory&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;Grant any object privilege&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;grant any privilege&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;Grant any role&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l1 level1 lfo1; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;Restricted session&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal"&gt;&lt;span style="mso-fareast-language: EN-AU;"&gt;&lt;a href="http://www.bluegecko.net/oracle/amazon-rds-for-oracle-first-impressions-2/"&gt;&lt;span style="color: blue;"&gt;BlueGecko&lt;/span&gt;&lt;/a&gt;&amp;nbsp;notes a couple of others:&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l0 level1 lfo2; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-AU;"&gt;Datapump / imp / exp FULL_DATABASE privileges&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l0 level1 lfo2; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-AU;"&gt;Alter user, revoke or any DDL on SYS, SYSTEM or RDSADMIN users&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l0 level1 lfo2; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-AU;"&gt;Drop tablespace RDSADMIN&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal" style="margin-left: 36.0pt; mso-list: l0 level1 lfo2; text-indent: -18.0pt;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-fareast-language: EN-AU;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-AU;"&gt;Create public synonyms for objects belonging to SYS, SYSTEM or RDSADMIN&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-language: EN-AU;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="SMSNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="SMSNormal"&gt;Most of those are pretty obviously 'dangerous'. These are the items that, in an organisation with a hierarchy of DBAs, would only be available to the Top Gun. And in this environment, Amazon holds that position.&lt;/div&gt;&lt;div class="SMSNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="SMSNormal"&gt;The 'CREATE ANY DIRECTORY' is one where you need to think evil before you work out why it is so dangerous. So I shall adopt the persona of the villainous toad, '&lt;a href="http://danmacgregor.wikia.com/wiki/Baron_Silas_Greenback"&gt;Baron Silas Greenback&lt;/a&gt;', sit back in my black leather chair and stroke my furry white pet while I explain the plot. Then you can escape my henchmen and save the day.&lt;/div&gt;&lt;div class="SMSNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="SMSNormal"&gt;The plan is cunning in its simplicity. Simply create an Oracle directory that points to the OS directory containing the Oracle data files. Then I could use UTL_FILE to read and even update those datafiles directly, without going through the protective SQL layer. The operation through UTL_FILE is, as far as the operating system is concerned, indistinguishable from an official, controlled change through an INSERT statement.&amp;nbsp;&lt;/div&gt;&lt;div class="SMSNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="SMSNormal"&gt;In fact any of the Oracle database files could be accessed this way. Control files, redo logs, audit trails...&amp;nbsp;In short, directory privileges are REALLY nasty things.&lt;/div&gt;&lt;div class="SMSNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="SMSNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2272996493066612703?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2272996493066612703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2272996493066612703' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2272996493066612703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2272996493066612703'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/06/locked-down-in-oracle-amazon-rds.html' title='Locked down in Oracle Amazon RDS'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-9089185944904745183</id><published>2011-06-02T19:30:00.001+10:00</published><updated>2011-06-02T19:30:00.264+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='non-oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>The www of sydoracle.com</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" &gt;When I moved my blog to sydoracle.com, I intentionally put it under a "blog" subdomain rather than at &lt;a href="http://www.sydoracle.com"&gt;www.sydoracle.com&lt;/a&gt;. The idea was that I'd eventually get around to building a conventional website. By that I mean that I am in awe of Tim Hall's oracle-base.com (content, structure, etc) and have delusions of grandeur about making something similar.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;Apparently this subdomain split isn't great for search engine optimization as it treats them as different sites. I guess search engines don't want to draw assumptions for mastercheesemakerbook.wordpress.com from jonathanlewis.wordpress.com. So don't do this.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;For over a year, it was pretty much &lt;a href="http://en.wikipedia.org/wiki/Lorem_ipsum"&gt;Lorem Ipsum&lt;/a&gt;, with tumbleweeds rolling about, and the sounds of far-off &lt;a href="http://en.wikipedia.org/wiki/Whip-poor-will#Cultural_references"&gt;Whipporwills&lt;/a&gt; in the hills.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; "&gt;Partly inspired by playing with the /seo and /seourl search tags in blekko, I spent some time thinking about Search Engine Optimization, and decided to get my www subdomain in some sort of order. It is all built using the standard &lt;a href="http://www.google.com/sites/overview.html"&gt;Google Sites&lt;/a&gt; (which you can think of as a very simple, and free, Content Management System).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Most of it is pretty standard web site stuff. &lt;a href="http://www.sydoracle.com/aboutme"&gt;Bio&lt;/a&gt;, a couple of &lt;a href="http://www.sydoracle.com/oracle-links"&gt;pages&lt;/a&gt; of &lt;a href="http://www.sydoracle.com/forums-and-community"&gt;links&lt;/a&gt;, some &lt;a href="http://www.sydoracle.com/essays"&gt;articles&lt;/a&gt; (mostly to see if I could write something with the aim of search results, rather than just as a brain dump) and copies of a few &lt;a href="http://www.sydoracle.com/presentations"&gt;presentations&lt;/a&gt; I've made.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;Then I tried to stretch things to some of the other Google gems. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;  &lt;a href="http://www.sydoracle.com/upcoming-events"&gt;Upcoming Events&lt;/a&gt; leverages Google Calendar, and currently shows up the &lt;a href="www.sydneyoracle.com.au"&gt;Sydney Oracle Meetups&lt;/a&gt; calendar. I may merge in other calendars later.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;  The '&lt;a href="http://www.sydoracle.com/contact-and-enquiries"&gt;Contact Me&lt;/a&gt;' part is a form that feeds off to a Google Docs spreadsheet and notifies my GMail account. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;  The '&lt;a href="http://www.sydoracle.com/book-me"&gt;Book Me&lt;/a&gt;' part is a Google Apps gadget for "You Can Book Me", because I wanted to link in something from the Google Apps Marketplace.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;  Then there is &lt;a href="http://outerjoin.sydoracle.com"&gt;OuterJoin.sydoracle.com&lt;/a&gt; which runs off Google Moderator. It's sort of a Q&amp;amp;A, crowd vote thingy. I'm not particularly keen on its fit for use. Apparently stuff there doesn't come up in search, you've got no control over formatting (which is a pain for anything code related) and the layout is pretty fixed. But if you've got any questions, feel free to sling them in. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I've also been trying out writing some Google Apps Engine code in Java. It's cool. I'm not sure whether it is the &lt;a href="http://code.google.com/appengine/docs/java/gettingstarted/"&gt;tutorial&lt;/a&gt; or the fact that I haven't had to try to install web servers, app servers and frameworks, but I've found it easier to focus on the coding process there than my previous attacks on the subject. Now if someone could write a decent Forum / FAQ / Q&amp;amp;A system in that.....&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I fully intend to add some of my standard code packages to the site at some point. I've never been completely happy with large chunks of code in my blog, and this would be a tidier solution. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;I'm open to other suggestions.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-9089185944904745183?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/9089185944904745183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=9089185944904745183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/9089185944904745183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/9089185944904745183'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/06/www-of-sydoraclecom.html' title='The www of sydoracle.com'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-8142395345935648709</id><published>2011-06-01T19:30:00.002+10:00</published><updated>2011-06-01T19:30:00.293+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Licensing can be fun....NOT</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Some notes to help me work out what I am, and more importantly, am NOT allowed to use.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Check your edition. V$VERSION will tell you if you are on Standard, Enterprise, Express or Personal Editions.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Enterprise Edition can use Diagnostics and Tuning Features if the option is licensed.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Personal Edition includes "all of the options that are available with Enterprise Edition", except RAC. Shame it is Windows only.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Standard and Express are definite No-No's&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;For 11gR2, check the parameter CONTROL_MANAGEMENT_PACK_ACCESS.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;A canny DBA will have this set to NONE if the Diagnostics and Tuning pack are not licensed.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The 11gR2 Beta for XE has this value set to NONE so maybe they'll do that as a default in future.&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;If the package dbms_awr is installed, then there's a good chance it was done so in order to disable AWR data gathering.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Check the name, detected_usages and currently_used columns from DBA_FEATURE_USAGE_STATISTICS&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;If it isn't disallowed, disabled and has been used then there's a reasonable chance it is licensed, but check with the DBA anyway. But at least you won't annoy them when it is obviously not allowed.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;What is off limits (based on the 11th revision of&amp;nbsp;&lt;a href="http://download.oracle.com/docs/cd/E11882_01/license.112/e10594/toc.htm"&gt;11gR2 licensing document&lt;/a&gt;&amp;nbsp;-&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma, sans-serif; font-size: x-small;"&gt;E10594-11&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;) includes :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Packages : DBMS_WORKLOAD_REPOSITORY, DBMS_ADDM, DBMS_ADVISOR (for ADDM, Tuning Advisor or Access Advisor),&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;DBMS_WORKLOAD_REPLAY.COMPARE_PERIOD_REPORT, DBMS_SQLTUNE, &lt;span class="Apple-style-span" style="background-color: yellow;"&gt;DBMS_XPLAN.DISPLAY_AWR&lt;/span&gt; (which uses DBA_HIST views)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;V$ Views : V$ACTIVE_SESSION_HISTORY, V$SQL_MONITOR, V$SQL_PLAN_MONITOR&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Other views: DBA_ADDM_, &lt;span class="Apple-style-span" style="background-color: yellow;"&gt;DBA_HIST_&lt;/span&gt; (except DBA_HIST_SNAPSHOT, DBA_HIST_DATABASE_INSTANCE, DBA_HIST_SNAP_ERROR,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;DBA_HIST_SEG_STAT, DBA_HIST_SEG_STAT_OBJ, and DBA_HIST_UNDOSTAT)&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBA_STREAMS_TP_PATH_BOTTLENECK and DBA_STREAMS_TP_COMPONENT_STAT (some),&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;DBA_ADVISOR_ (some)&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Reports : &amp;nbsp;awrrpt.sql, awrrpti.sql, awrgrpt.sql, awrgrpti.sql, awrgdrpt.sql, awrgdrpi.sql, addmrpt.sql, addmrpti.sql,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;ashrpt.sql, ashrpti.sql, awrddrpt.sql, awrddrpi.sql, awrsqrpi.sql, awrsqrpt.sql, awrextr.sql,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;awrload.sql, awrinfo.sql, spawrrac.sql&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Generally you are licensed for "internal business operation". At the recent &lt;a href="http://www.sydneyoracle.com.au/events/17188163/"&gt;Sydney Oracle Meetup&lt;/a&gt;, &lt;a href="http://twitter.com/mnorgaard"&gt;Mogens Nørgaard&lt;/a&gt; pointed out that you aren't allowed to use your databases to train people outside your company. One exception is Express Edition which &lt;a href="http://www.oracle.com/technetwork/licenses/xe-license-152020.html"&gt;expressly&lt;/a&gt; (sorry) states "(c) you may use the programs to provide third party demonstrations and training; "&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;So if anyone around Sydney wants some training on Oracle SQL, PL/SQL or similar, I'm open to offers :) But you may want to wait until the XE 11gR2 goes live.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-8142395345935648709?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/8142395345935648709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=8142395345935648709' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8142395345935648709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8142395345935648709'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/06/licensing-can-be-funnot.html' title='Licensing can be fun....NOT'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2749939554871253002</id><published>2011-05-12T17:30:00.001+10:00</published><updated>2011-05-14T14:25:46.148+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Bullet proofing entire record inserts/updates</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;There's a handy feature in PL/SQL that lets you &lt;a href="http://download.oracle.com/docs/cd/E18283_01/appdev.112/e17126/composites.htm#i36801"&gt;insert an entire record&lt;/a&gt; into a table without specifying each individual field in the record. Here's an example.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;create table wide_test&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; (id number,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;col_a varchar2(10), col_b varchar2(10),&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;col_c varchar2(10));&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;declare&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; cursor c_wide is&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;select *&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;from wide_test;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec c_wide%rowtype;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;begin&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.id := 1;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_a := 'A';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_b := 'B';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_c := 'C';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; --&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; insert into wide_test&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; values v_rec;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;end;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select * from wide_test;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;But if you give that to a code reviewer, they may tell you that using SELECT * is bad practice. What happens when a new column is added to the table ? So he makes you recode it.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;declare&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; cursor c_wide is&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;select id, col_a, col_b, col_c&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;from wide_test;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec c_wide%rowtype;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.id := 2;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_a := 'A';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_b := 'B';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_c := 'C';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; --&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; insert into wide_test&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; values v_rec;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select * from wide_test;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;Everyone is happy....until a new column is added to the table.&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;ALTER TABLE wide_test ADD col_d VARCHAR2(10) DEFAULT 'D' NOT NULL;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;declare&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; cursor c_wide is&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;select id, col_a, col_b, col_c&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;from wide_test;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec c_wide%rowtype;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.id := 3;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_a := 'A';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_b := 'B';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_c := 'C';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; --&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; insert into wide_test&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; values v_rec;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into wide_test&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;ERROR at line 12:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;ORA-06550: line 12, column 15:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;PL/SQL: ORA-00947: not enough values&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;That didn't quire go as planned. You get the same error if you try&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; insert into wide_test (id, col_a, col_b, col_c)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; values v_rec;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman';"&gt;&lt;/span&gt;Perhaps the SELECT * was the right way to go ?&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;declare&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; cursor c_wide is&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;select *&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;from wide_test;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec c_wide%rowtype;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.id := 3;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_a := 'A';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_b := 'B';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_c := 'C';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; --&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; insert into wide_test&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; values v_rec;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;declare&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;ERROR at line 1:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;ORA-01400: cannot insert NULL into ("PERFORM"."WIDE_TEST"."COL_D")&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: black; font-family: 'Times New Roman';"&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;Nope ! The "col_b" in v_rec isn't set so remains NULL, but the database column is NOT NULL. Because a value is specified in the INSERT the default doesn't kick in.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;Happily there is a solution:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;declare&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; cursor c_wide is&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;select id, col_a, col_b, col_c&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;from wide_test;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec c_wide%rowtype;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.id := 3;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_a := 'A';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_b := 'B';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_c := 'C';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; --&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; insert into&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; (select id, col_a, col_b, col_c&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; from wide_test)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; values v_rec;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select * from wide_test;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;We use an inline view as the target of the insert. Since the order of the columns is specified in the inline view, this will continue to work even if someone re-arranges the columns in the underlying table. A regular, permanent, view in the database works just as well.&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;This is called the &lt;a href="http://download.oracle.com/docs/cd/E18283_01/appdev.112/e17126/insert_statement.htm#CJADIJED"&gt;Insert Statement Extension&lt;/a&gt;&amp;nbsp;and there's a similar facility for &lt;a href="http://download.oracle.com/docs/cd/E18283_01/appdev.112/e17126/update_statement.htm#CJAIGFJI"&gt;UPDATE&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;DECLARE&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; cursor c_wide is&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;select col_a, col_b, col_c&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;from wide_test;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec c_wide%rowtype;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_a := 'A1';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_b := 'B1';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; v_rec.col_c := 'C1';&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; UPDATE&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;(SELECT col_a, col_b, col_c&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; FROM wide_test)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; SET ROW = v_rec;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2749939554871253002?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2749939554871253002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2749939554871253002' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2749939554871253002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2749939554871253002'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/05/bullet-proofing-entire-record.html' title='Bullet proofing entire record inserts/updates'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-1236112363906886193</id><published>2011-05-10T17:30:00.008+10:00</published><updated>2011-05-10T17:30:01.438+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='non-oracle'/><title type='text'>Encouraging women in information technology</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;I participated in a twitter dialogue with &lt;a href="http://blog.infoadvisors.com/index.php/tag/datachick"&gt;@datachick&lt;/a&gt; (Karen Lopez) last week on the #WIT (women in technology or women in information technology ?) hash tag.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;alert: a="" an="" are="" can="" decide="" don't="" exceptional.="" exceptions.="" fit="" freak,="" generalisations,="" generalisations="" if="" in="" made="" many="" or="" outlier="" post.="" simply="" the="" then="" there="" this="" whether="" you=""&gt; &lt;br /&gt;I don't think there'd be much argument that women are under-represented in IT, and that a more balanced split would benefit the whole industry.&lt;br /&gt;&lt;br /&gt;My question was what can us blokes do to encourage more women into the industry (or to stay in the industry). There were a couple of helpful suggestions. Karen's first point was to encourage girls into STEM courses (Science, Technology, Engineering and Maths). No problem there. We could also do with a few more teachers specializing in those areas, but that's a separate topic.&lt;br /&gt;&lt;br /&gt;Another point was that women may not push their opinion into a discussion, and it could be helpful to actually ask for their input. Or ask for their help if you are stuck. They know stuff. I follow several women tweeters/bloggers, including &lt;a href="http://www.dbakevlar.com/"&gt;DBAKevlar&lt;/a&gt;, datachick, &lt;a href="http://erinstellato.com/"&gt;Erin Stellato&lt;/a&gt;, &lt;a href="http://blog.lisadobson.com/"&gt;Lisa Dobson&lt;/a&gt;, &lt;a href="http://prodlife.wordpress.com/"&gt;Gwen Shapira&lt;/a&gt;, &lt;a href="http://www.mcneelytech.com/blog1"&gt;Mary McNeely&lt;/a&gt;, &lt;a href="http://boneist-oracle.livejournal.com/"&gt;Boneist&lt;/a&gt;.... Not because they are women, but because they contribute interesting content. &lt;br /&gt;&lt;br /&gt;Karen then recommended challenging any ant-diversity practices and &lt;a href="http://www.twitter.com/zippy1981"&gt;@zippy1981&lt;/a&gt; raised the matter of introversion. There are a lot of introverts in IT. Sitting in a corner, coding away. I suspect there will be fewer in years to come, at least in development. The increasing pace of change, and a closer dependence of the business on IT, means less scope for solitary activity. Again, another topic.&lt;br /&gt;&lt;br /&gt;But in the meantime, introverts are not going to be the ones giving talks at schools on career day. Or challenging the alpha-males in the executive positions who might skimp on diversity-friendly practices. &lt;br /&gt;&lt;br /&gt;True Story: One place I worked had the ladies toilet larger on each floor than the gents (because cubicles take up more room than urinals), except on one floor. The large skew in the IT section meant that the gents got extra space. This sometimes confused women visiting the floor....but never more than once. There's a lot of gray area between recognising an existing imbalance, reinforcing it and falling back to the "it's an industry norm" excuse. &lt;br /&gt;&lt;/alert:&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;alert: a="" an="" are="" can="" decide="" don't="" exceptional.="" exceptions.="" fit="" freak,="" generalisations,="" generalisations="" if="" in="" made="" many="" or="" outlier="" post.="" simply="" the="" then="" there="" this="" whether="" you=""&gt;&lt;/alert:&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;alert: a="" an="" are="" can="" decide="" don't="" exceptional.="" exceptions.="" fit="" freak,="" generalisations,="" generalisations="" if="" in="" made="" many="" or="" outlier="" post.="" simply="" the="" then="" there="" this="" whether="" you=""&gt;I don't have any solutions. It is just something to think about.&lt;br /&gt;&amp;nbsp;&lt;/alert:&gt;&lt;/div&gt;&lt;alert: a="" an="" are="" can="" decide="" don't="" exceptional.="" exceptions.="" fit="" freak,="" generalisations,="" generalisations="" if="" in="" made="" many="" or="" outlier="" post.="" simply="" the="" then="" there="" this="" whether="" you=""&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;Oh, and the recent XKCD is sort of appropriate.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/alert:&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="320" src="http://imgs.xkcd.com/comics/marie_curie.png" width="192" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;This is a reconstructed / edited extract of the twitter conversation:&lt;/div&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;syd_oracle: How can we (men) encourage without being patronising ? #WIT&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;datachick: Best? Talk to young people about your career and the opportunities it provides. Encourange them to tak STEM courses.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;MelikaNoKaOi: I see a lot of women in IT who are afraid to offer their ideas, so ask them for their ideas directly :) #WIT&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;retracement: Simple. Actually talking to women in IT (at minimum) as our equals, which quite frankly shouldn't be that hard to do. #WIT&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;retracement:Men are generally useless even talking to other men, never mind women so that's probably the real issue. #WIT&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;datachick: People can help by challenging immediately anyone who contributes to anti-diversity practices.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;zippy1981: So your asking a bunch of introverts to challenge the alphas, who became successful by choosing not to be the alphas&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;datachick: Are you saying that Women are introverts? Not my experience...&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;datachick: I want to solve the problem of girls tinking that IT is a solitary job. None of my work has been.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;datachick: Or that the only IT job is programming. I still fight that one, though, with adults.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;zippy1981:Well for some it is an ideal. Don't get me wrong I appreciate good PMs, despise the mediocore ones, and respect great admins 1/2&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;zippy1981:so head dwn pgrming is not the only path, but if its your ideal path your not gonna push your daughter to be a sales engineer 2/2&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;datachick: Generally young girls are attracted to more collaborative jobs, which is why I want them to know IT has those.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;zippy1981:I'm all for them taking those jobs so I can sit in the corner. Give me a fast Computer and a bug report to steer her by.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;zippy1981:I'm saying that MIT that would appreciate more #WIT would encourage them to follow the same path that got them there.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;zippy1981:I guess what I'm saying is I'm going to encourage a person who wants to be in my field to follow what worked for me.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;datachick:That makes sense. I would do the same (and I spent only a trivial amount of time as a dev.)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-1236112363906886193?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/1236112363906886193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=1236112363906886193' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1236112363906886193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1236112363906886193'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/05/encouraging-women-in-information.html' title='Encouraging women in information technology'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-8602511794613976196</id><published>2011-05-10T15:43:00.002+10:00</published><updated>2011-05-10T15:44:17.165+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='non-oracle'/><title type='text'>Crossover</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;When should I retweet someting ?&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;I follow a lot of Oracle peeps, including the big names such as Cary Milsap. I've got a few followers too, and the vast majority of them are also Oracle peeps. If Cary tweets something then there's not much point in me re-tweeting it because very few of my followers wouldn't have seen Cary's original.&lt;br /&gt;&lt;br /&gt;I also follow a few antipodean tweeters, and a couple in the security area and some SQL Server ones. The same pattern applies to blogs I follow. I've got Google Reader set up so that if I share something there, it comes out as a tweet.&lt;br /&gt;&lt;br /&gt;I'm more likely to share/tweet/retweet something from the 'non Oracle' field as I think it will reach a different audience. Crossover is important. &lt;a href="http://www.mcneelytech.com/blog1/?p=116"&gt;Mary McNeely&lt;/a&gt; went to talk Oracle to some Unix people. &lt;br /&gt;&lt;br /&gt;I can't see myself as a world-class Oracle guru. But I am one of a small number of Australian Oracle bloggers. It is the crossover aspects which allows us to contribute into the community&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-8602511794613976196?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/8602511794613976196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=8602511794613976196' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8602511794613976196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8602511794613976196'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/05/crossover.html' title='Crossover'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-1821609919145056811</id><published>2011-05-07T14:39:00.000+10:00</published><updated>2011-05-07T14:39:15.169+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='databases'/><title type='text'>From CRUD to AAAR - Pirates of Tahiti</title><content type='html'>When I wore a &lt;a href="http://www.lyrics007.com/Billy%20Joel%20Lyrics/Piano%20Man%20Lyrics.html"&gt;younger man's clothes&lt;/a&gt;, everything was cruddy. CREATE, READ, UPDATE and DELETE. Which equated to 'INSERT, SELECT, UPDATE and DELETE' in SQL terms. We didn't have MERGE in them days.&lt;br /&gt;&lt;br /&gt;DELETE was the first to go. It was too hard to get back something you'd deleted, and something ALWAYS got deleted by mistake. We first moved to a 'soft delete', which meant setting a flag on the record indicating it should be (generally) ignored. After we ended up with tables that were 90% 'deleted' records, we went a step further. That's my first 'A' ; Archiving - moving the record into a separate table where it was easier to ignore.&lt;br /&gt;&lt;br /&gt;UPDATE also gives problems. When your system was used by three men and a dog, you didn't run into too many concurrency conflicts. They generally worked on different records and only very occasionally had to wait on another user's locks. As you start to scale up, you run into more conflicts. Everyone would be trying to update the daily balance at the same time. You've all seen the effect at traffic lights. You reach the load point where more people are being added to the traffic queue than are being let through on each green light. It only sorts itself out when the load drops, and try telling sales that you need fewer customers.&lt;br /&gt;&lt;br /&gt;So rather than UPDATE, you do INSERT or CREATE or, as I'm calling it to fit the pirate theme, APPEND. My second 'A'. Say you have 100 iPads in stock, and have them on a single stock record. Every sale you make, you need to update that record to reduce the available quantity. Only one person can update it at a time and everyone else has to wait. So rather than update the record, you append a transaction record saying how many you sold. I can insert a record and you can insert a record and neither of us has to wait for the other to finish. [Oracle can actually be smart so that when two people are inserting records at the same time, they actually go into different database blocks.]&lt;br /&gt;&lt;br /&gt;Some of the NoSQL databases go further. Say I've got a profile record giving my account id, name and email address and I want to update the email address. Rather than do an update of the record, I actually append a new record with a later timestamp or version number and the new email address. This gives me a better audit history, and an easier replication mechanism between distributed copies of the data (because the timestamp settles arguments about the order in which things happened).&lt;br /&gt;&lt;br /&gt;The third 'A' is for Aggregation. I take my set of sales transaction and total them up to see how many I sold. I have another set of data indicating how many I've bought. Eventually they'll balance out, even if I have to append some '-1' records to my sales and give refunds to a disappointed fanboi or two. Or with my profile, I take the details from the record with the highest version. Eventually the older ones may be archived.&lt;br /&gt;&lt;br /&gt;At the end we will always have 'R' for reading. There's not much point in collecting data that no-one ever reads.&lt;br /&gt;&lt;br /&gt;Anyway, that's why there are so many &lt;a href="http://en.wikipedia.org/wiki/International_Talk_Like_a_Pirate_Day"&gt;pirates&lt;/a&gt; involved in databases these days. I don't have any explanation for any cowboys in the industry.&lt;br /&gt;&lt;br /&gt;PS. tahiti.oracle.com is Oracle's Document Search engine. I don't think it was very big on pirates, but if I had mentioned the&amp;nbsp;Caribbean&amp;nbsp;I probably would have ended up with Disney's lawyers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-1821609919145056811?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/1821609919145056811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=1821609919145056811' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1821609919145056811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1821609919145056811'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/05/from-crud-to-aaar-pirates-of-tahiti.html' title='From CRUD to AAAR - Pirates of Tahiti'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-5715534316768828404</id><published>2011-05-05T20:15:00.002+10:00</published><updated>2011-05-05T20:15:00.442+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><title type='text'>Why we learn maths</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;I've got a parent table of movies and child table of ratings where people give the film a score on a scale of 1 to 10. In my display, I want to display an average rating for the film.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;I don't want to calculate the average of scores of rows for each display. With a large ratio of 'child' to 'parent' that could be very expensive. I want to denormalise but only just enough.&lt;br /&gt;&lt;br /&gt;Say "Thor" has a current average score of 7 and a new review adds a rating of 2, what does that do to my average ? You can't tell from those figures, because an average is a ratio. Whenever you derive one value from multiple values, you are going to lose some functionality.&lt;br /&gt;&lt;br /&gt;What I should do is take a step back and store on my movie table a TOTAL of people's rating, plus a COUNT of the number of ratings. Now, rather than an average of 7, I've got 10 reviews with a total rating of 70. Add in my new row and I've got 11 reviews with a total of 72 (giving an average of a bit more than 6.5). I don't need to re-read all those individual rows to recalculate the average.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;This is why we learn maths !&lt;br /&gt;&lt;br /&gt;The next issue will be contention. Fifty people coming out of a screening, all adding their ratings at the same time. Scary ? INSERTs are good at concurrency. There might be a few brief latches/mutex's over sequences and index blocks, but no actual locking problems. Updates are a different matter, and if we get fifty people tring to update the total/count values at the same time it will get ugly.&lt;br /&gt;&lt;br /&gt;This is where queues come in. Have those 50 inserted rows join a queue and a single process dequeue them to calculate and&amp;nbsp; update the movie's total and count. &lt;br /&gt;&lt;br /&gt;This is why we learn computer science. Of course similar things happen in the real world too, and &lt;a href="http://en.wikipedia.org/wiki/Queueing_theory"&gt;queuing theory&lt;/a&gt; is....a part of maths.&lt;br /&gt;&lt;br /&gt;The queue / de-queue model may show inconsistencies while waiting for ratings to be processed off the queue. Is 'Eventually Consistent' good enough ? If you need transactional consistency then leave the ratings in a 'pending' state until after they've been de-queued. If you need immediacy AND transactional consistency, then you'll end up with a potential bottleneck. Recognising immovable objects is a vital lesson to learn too. &lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Inspired by a &lt;a href="http://stackoverflow.com/questions/5876568/oracle-calculate-average-using-a-trigge"&gt;stackoverflow question&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-5715534316768828404?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/5715534316768828404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=5715534316768828404' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5715534316768828404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/5715534316768828404'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/05/why-we-learn-maths.html' title='Why we learn maths'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-6005094413295447728</id><published>2011-05-03T07:30:00.002+10:00</published><updated>2011-05-03T07:30:00.157+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='non-oracle'/><title type='text'>Worried about gamification and gender bias</title><content type='html'>One fun part about blogging is that you don't need to be an expert in everything, you don't need to know all the answers, and sometimes you can throw out an opinion or questions and see what reaction you get. This is one of those posts.&lt;br /&gt;&lt;br /&gt;I play Steven Feuerstein's &lt;a href="http://www.plsqlchallenge.com/"&gt;PL/SQL Challenge&lt;/a&gt; pretty much every day. I see it as a fun way to keep my knowledge base exercised. I also follow &lt;a href="http://theappslab.com/2011/04/22/everyone-loves-a-good-quest/"&gt;theappslab&lt;/a&gt; which has covered gamification for a &lt;a href="http://theappslab.com/2009/11/05/why-gaming-is-the-future-of-everything/"&gt;while&lt;/a&gt;, and I recognize the Challenge as applying gamification to learning, with its leaderboard and achievements (for both ranking and participation), plus prizes at the end of the Quarterly Quest. &lt;br /&gt;&lt;br /&gt;Then I turn around and see that "&lt;a href="http://www.lifehacker.com.au/2011/04/female-it-staff-are-still-getting-paid-less-then-males/"&gt;Female IT Staff Are Still Getting Paid Less Then Males&lt;/a&gt;", also reported &lt;a href="http://www.theaustralian.com.au/australian-it/stereotypes-blamed-for-28pc-pay-gap-in-technology-sector/story-e6frgakx-1226044594802"&gt;here&lt;/a&gt;.I think salary is too simplistic a measure. I had lunch with one Java programmer a couple of weeks back andwe did discuss general pay and conditions between her (public sector) job and my one as a consultant. I may get paid more, but I have a longer working week and less control about where I'm working (plus I've been in the business a bit longer - though there's a point where years don't usefully equate to experience). &lt;br /&gt;&lt;br /&gt;I follow @datachick who often tweets about Women in technology (and NASA and barbie and a whole bunch of stuff). And I look around a lot of the places I work and see more blokes than women. I do think we, as an industry, need to do something to encourage more equal participation.&lt;br /&gt;&lt;br /&gt;I wonder whether gamification offers any opportunities for that encouragement, or whether it may actually make things worse. I've dug around a bit but haven't really found much useful data on gender bias here. &lt;a href="http://www.nickyee.com/eqt/menwomen.html"&gt;Nick Yee&lt;/a&gt; has looked at EverQuest and found that female players were more interested in the social aspects rather than goal-focussed. The vast majority of players are men which may indicate that the population was weighted towards a particular type of personality more common amongst men, but perhaps the same applies to the technology field.&lt;br /&gt;&lt;br /&gt;I don't want to pick on the PL/SQL Challenge. I enjoy it. I also like the elements of gaming in StackOverflow with its achievements and "powers" as points levels are gained. But I'd like some insight into how these might shape a male-dominated profession. You can pretty much guarantee that when an employer or a recruiter looks through CVs, they will be checking that person on Google and LinkedIn. Advertiser funded sites will use gamification to favour frequent participants.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-6005094413295447728?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/6005094413295447728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=6005094413295447728' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6005094413295447728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6005094413295447728'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/05/worried-about-gamification-and-gender.html' title='Worried about gamification and gender bias'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-627395855506698196</id><published>2011-04-29T16:28:00.000+10:00</published><updated>2011-04-29T16:28:32.453+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Developers need to understand licensing too</title><content type='html'>I am not a DBA. Well possibly by very &lt;a href="http://www.thatjeffsmith.com/archive/2011/04/are-you-a-real-dba/"&gt;loose standards&lt;/a&gt;, but I'm not professionally or personally responsible for any databases that contain any valuable data.&lt;br /&gt;&lt;br /&gt;However I do work with databases on a daily basis and that means I need to be aware of licensing 'things'. Often I get access to accounts with privileges for various dictionary views. And there are some views and tables which can only be queried after supplying large amounts of folding paper to your friendly Oracle reseller.&lt;br /&gt;&lt;br /&gt;That's one of my dislikes about Oracle. I'd be much happier if those views and packages which require the diagnostic, tuning or whatever packs were secured by some additional role to make them EXTREMELY obvious.&lt;br /&gt;&lt;br /&gt;And development and test databases are another thing. It's all very well pretending things can be covered by OTN licences, but some things aren't. Throwing up another database for testing isn't necessarily covered by your existing licences. And what about that readonly standby ? Or that one on the VMWare server ?&lt;br /&gt;&lt;br /&gt;Anyway, I've got my diary booked in for&amp;nbsp;&lt;span class="Apple-style-span" style="color: #666666; font-family: verdana, arial, sans-serif; font-size: 12px; line-height: 18px;"&gt;&lt;a href="http://www.sydneyoracle.com.au/events/17188163/"&gt;Mogens Nørgaard&lt;/a&gt;&amp;nbsp;&lt;/span&gt;talking to us Sydneysiders about the joys of Oracle licensing in just under two weeks. If you've got any questions you want to pose (apart from why are they so bleeding expensive), add a comment.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I'd like to know more about &lt;a href="http://aws.amazon.com/rds/oracle/"&gt;Amazon Oracle pay-by-the-hour&lt;/a&gt;, due in the next couple of months, but I think we'll all have to wait for that.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-627395855506698196?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/627395855506698196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=627395855506698196' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/627395855506698196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/627395855506698196'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/04/developers-need-to-understand-licensing.html' title='Developers need to understand licensing too'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4610761088916099872</id><published>2011-04-29T15:45:00.001+10:00</published><updated>2011-04-29T15:45:00.141+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='non-oracle'/><title type='text'>Downtime, SLAs, compensation and other fairytales.</title><content type='html'>My brother-in-law in England has a beautiful framed photograph in his living room. It is of a small cottage with some trees just as a small sprinkling of snow has fallen on it. It's something that wouldn't look out of place on a Christmas card. But it isn't a commercially bought print. It is a photo that he took when chance put him in the right place at the right time. Plus he knows a thing or two about cameras and was able to do justice to the scene.&lt;br /&gt;&lt;br /&gt;It is all the more poignant because he took the negatives in to a photo shop to get some more prints and the shop lost the negatives. He would have got a few pounds in compensation for that loss. He'll never see the negative again though. For youngsters, cameras used to use film, which was processed into negatives from which prints were made.&lt;br /&gt;&lt;br /&gt;There were some places where you'd drop off the film, they'd send it off somewhere else to be processed, who'd deliver it back to the shop where you'd get the prints. Like a 'cloud' service, you never really knew where the film actually went. Keen photographers generally went somewhere which did their own development on the premises and things were less likely to go wrong. At the really cheap places, if something went wrong, you'd get a replacement film, blank of course.&lt;br /&gt;&lt;br /&gt;This isn't about 'cloud'. It is about compensation. You don't get the photos back. Having an SLA promise you 50% off your month's hosting fee of $20 if they have excessive downtime is pretty pathetic if you've lost $1000 in business.&lt;br /&gt;&lt;br /&gt;If you are paying for a service, whether it is power, telephone, data storage or CPUs, you are paying less than the service is worth to you. [If you are paying $50 for something you only value at $25, then your boss's nephew probably owns the supplier.] The provider has costs too, so the benefit (profit) to them in having you as a customer is less than the benefit (avoided loss) to you in having them as a supplier.&lt;br /&gt;&lt;br /&gt;If you own it, you have to look after it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4610761088916099872?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4610761088916099872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4610761088916099872' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4610761088916099872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4610761088916099872'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/04/downtime-slas-compensation-and-other.html' title='Downtime, SLAs, compensation and other fairytales.'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-7683138470252099913</id><published>2011-04-25T22:13:00.000+10:00</published><updated>2011-04-25T22:13:16.793+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='AWS'/><title type='text'>In which I apologize for the Amazon AWS Outage</title><content type='html'>Honestly, I didn't mean it to happen.&lt;br /&gt;&lt;br /&gt;I'm a (very) occasional user of AWS. And it is one of those businesses on the Internet where I pay using a pre-paid Visa card. Its one I have to remember to charge up every so often. And, in my defence,&amp;nbsp;I've been a bit busy the past couple of weeks.&lt;br /&gt;&lt;br /&gt;On April 18th I got an "urgent" message from Amazon saying that their attempt to charge me $0.09 for March usage had failed. And that if I didn't rectify the problem, they might suspend my account. But I was still busy so I didn't get round to recharging the card.&lt;br /&gt;&lt;br /&gt;On April 21st, I got an even more urgent message from Amazon about the 9c I owed them. My account was going to be suspended. That was sent about 2:30 am PDT. Apparently that 9c was pretty important as Amazon then had its &lt;a href="http://www.zdnet.com/blog/btl/amazons-n-virginia-ec2-cluster-down-networking-event-triggered-problems/47679?tag=mantle_skin;content"&gt;tummy ache&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I have since recharged my card and today got a message that Amazon had successfully processed the 9c charge. Hopefully all problems will be over. If I had known that my 9c would bring down half a data centre, I'd have made sure I was charged up. I'll try to make sure it doesn't happen again.&lt;br /&gt;&lt;br /&gt;Thank you for your patience.&lt;br /&gt;&lt;br /&gt;PS. Some 'scientists' may start talking about the difference between 'correlation' and 'causation' and the lack of any technical analysis in my reaction. But I remember reading "&lt;a href="http://en.wikipedia.org/wiki/For_Want_of_a_Nail_(proverb)"&gt;For want of a nail&lt;/a&gt;" in primary school so its quite logical to me ! Besides my horoscope said that coincidences don't exist, it's all part of a larger design and don't trust Aquarians.&lt;br /&gt;&lt;br /&gt;PPS. For a more serious take on cloud storage, try &lt;a href="http://joyeur.com/2011/04/24/magical-block-store-when-abstractions-fail-us/"&gt;Joyent's blog&lt;/a&gt;&amp;nbsp;(link via Robert Young at &lt;a href="http://drcoddwasright.blogspot.com/2011/04/was-cloudy-day.html"&gt;"Dr Codd was Right"&lt;/a&gt;&amp;nbsp;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-7683138470252099913?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/7683138470252099913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=7683138470252099913' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7683138470252099913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7683138470252099913'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/04/in-which-i-apologize-for-amazon-aws.html' title='In which I apologize for the Amazon AWS Outage'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-7037101575482944667</id><published>2011-04-02T17:45:00.002+11:00</published><updated>2011-04-02T17:45:00.290+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>How COLLECT displaced User Defined Aggregates</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;A recent PL/SQL Challenge &lt;a href="http://www.plsqlchallenge.com/pls/apex/f?p=10000:651:7087574734291247::NO::P651_QUIZ_ID:2124"&gt;question&lt;/a&gt; focussed on a user defined aggregate. Not a lot of people got it right, and one reason is that they have never been particularly popular. Tom Kyte's &lt;a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:2196162600402"&gt;STRAGG&lt;/a&gt; function (dating back to 2001) was probably the best known usage. But they are basically complicated and a bit ugly.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;When 10g came along, it added the COLLECT aggregate function. That meant that the old style user defined aggregates were pretty much redundant. It is a lot easier to aggregate up using COLLECT and then pass the collection to a regular function.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;It is also more flexible. As an&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;example, since the user-defined aggregates could only have one parameter, it wasn't possible to pass a delimiter to the STRAGG function. This implementation, based on a 'regular' function overcomes that:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE TYPE TAB_CHAR IS table of VARCHAR2(4000);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;create or replace function coll_to_delimited&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;(i_coll_type in tab_char, i_delim in varchar default ',')&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;return varchar2&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;is&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_ret varchar2(32767);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;begin&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;FOR i IN 1..i_coll_type.count LOOP&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;IF instr(i_coll_type(i),i_delim) &amp;gt; 0 THEN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;RAISE_APPLICATION_ERROR(-20001,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Delimiter present in string:'||i_coll_type(i));&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;END IF;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;v_ret := v_ret || i_coll_type(i);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;IF i != i_coll_type.count THEN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;v_ret := v_ret||i_delim;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;END IF;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;END LOOP;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;RETURN v_ret;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;end;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select coll_to_delimited(cast(&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;collect(table_name)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; as tab_char),'|')&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;from user_tables;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;I've even included a check to indicate where a string already includes the delimiter. I don't bother to include a specific check on length as that would be an error anyway.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-7037101575482944667?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/7037101575482944667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=7037101575482944667' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7037101575482944667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7037101575482944667'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/04/how-collect-displaced-user-defined.html' title='How COLLECT displaced User Defined Aggregates'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4003060686440450483</id><published>2011-04-02T10:07:00.000+11:00</published><updated>2011-04-02T10:07:08.862+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Generate an SQL replay file using TKPROF</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Handy hint. You can use TKPROF's "record" option to extract a 'replay' script from a trace.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; exec dbms_monitor.session_trace_enable(binds =&amp;gt; true);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;PL/SQL procedure successfully completed.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; create table trace_test (id number, val varchar2(20));&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;Table created.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; insert into trace_test values (1,'abcef');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;1 row created.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; insert into trace_test values (2,'xyz');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;1 row created.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; disconn&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Then switch to the udump directory and find the trace file you created.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;In my case it was xe_ora_3972.trc&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;tkprof record=rec.txt trace= xe_ora_3972.trc output= r2.txt&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace;"&gt;TKPROF: Release 10.2.0.1.0 - Production on Sat Apr 2 10:02:28 2011&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red; font-family: 'Courier New', Courier, monospace;"&gt;Copyright (c) 1982, 2005, Oracle. &amp;nbsp;All rights reserved.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Then you can rerun the output from your record.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;H:\oraclexe\app\oracle\admin\XE\udump&amp;gt;more rec.txt&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN dbms_monitor.session_trace_enable; END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN dbms_monitor.session_trace_enable(binds =&amp;gt; true); END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;create table trace_test (id number, val varchar2(20)) ;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into trace_test values (1,'abcef') ;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into trace_test values (2,'xyz') ;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4003060686440450483?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4003060686440450483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4003060686440450483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4003060686440450483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4003060686440450483'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/04/generate-sql-replay-file-using-tkprof.html' title='Generate an SQL replay file using TKPROF'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4547117982224020221</id><published>2011-03-31T18:30:00.003+11:00</published><updated>2011-03-31T18:30:00.642+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>How to un-confuse SQL Developer with ORA-00932</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Sometimes SQL Developer will throw back a message like "ORA-00932: inconsistent datatypes: expected NUMBER got -". One way to get this is to try to execute&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select collect(column_name) from user_tab_columns&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;The problem the tool is having is that it is getting back a data type which it doesn't recognize.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;If you don't already have a defined collection type, then go create one as they are really useful. This is mine&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE TYPE TAB_CHAR IS table of VARCHAR2(4000);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif;"&gt;Then you can do an explicit CAST in the select statement and the error will go away.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select cast(collect(column_name) as tab_char) from user_tab_columns&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4547117982224020221?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4547117982224020221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4547117982224020221' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4547117982224020221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4547117982224020221'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/how-to-un-confuse-sql-developer-with.html' title='How to un-confuse SQL Developer with ORA-00932'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-3828759403669420812</id><published>2011-03-30T18:00:00.002+11:00</published><updated>2011-03-30T18:00:10.888+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Implicit rounding on INSERT</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Last week I had another &lt;a href="http://www.plsqlchallenge.com/pls/apex/f?p=10000:651:2761401314863616::NO::P651_QUIZ_ID:2125"&gt;quiz&lt;/a&gt; on the PL/SQL Challenge. There was a twist in its tail which meant that only about a quarter of players got it right.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Consider the following table and procedure.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE TABLE plch_products&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; product_id &amp;nbsp; &amp;nbsp; NUMBER (2, 0)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;, product_name &amp;nbsp; VARCHAR2 (10)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;, stage &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NUMBER (2, 0)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;, CONSTRAINT plch_products_pk PRIMARY KEY (product_id)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; INSERT INTO plch_products&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VALUES (1, 'Mouse', 10);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; COMMIT;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE PROCEDURE ins_upd_product&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(i_product_id &amp;nbsp; &amp;nbsp; IN NUMBER&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; , i_product_name &amp;nbsp; IN VARCHAR2)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;IS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; INSERT INTO plch_products (product_id, product_name, stage)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VALUES (i_product_id, i_product_name, 20);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;EXCEPTION&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; WHEN DUP_VAL_ON_INDEX&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; THEN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;UPDATE plch_products&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SET product_name = i_product_name, stage = 30&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; WHERE product_id = i_product_id;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; WHEN OTHERS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; THEN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;UPDATE plch_products&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SET product_name = i_product_name, stage = 40;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;If I pass in a product_id of &lt;b&gt;1.1&lt;/b&gt;, the value will get implicitly rounded during the INSERT to match the scale/precision of the table column. Because of this the product_id gets rounded to 1 and the insert fails due to a duplicate key. However in the exception handler, the UPDATE does NOT round the value for comparison so no rows match the criteria and none are updated..&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;So what can we do to prevent this problem.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Firstly, at least in 10g, the PL/SQL warnings don't cover scale/precision mismatches. They only cover data type mismatches (date to number, or even CHAR to VARCHAR2).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;%TYPE anchoring can help, but it has to be in the declare section. Using %TYPE in the procedure signature doesn't help because, again, those just relate to data type.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE PROCEDURE ins_upd_product&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(i_product_id &amp;nbsp; &amp;nbsp; IN NUMBER&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; , i_product_name &amp;nbsp; IN VARCHAR2)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;IS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_product_id &amp;nbsp; &amp;nbsp;plch_products.product_id%type;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_product_name &amp;nbsp;plch_products.product_name%type;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; v_product_id := i_product_id;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; v_product_name := i_product_name;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; INSERT INTO plch_products (product_id, product_name, stage)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VALUES (v_product_id, v_product_name, 20);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;EXCEPTION&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; WHEN DUP_VAL_ON_INDEX&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; THEN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;UPDATE plch_products&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SET product_name = v_product_name, stage = 30&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; WHERE product_id = v_product_id;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; WHEN OTHERS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; THEN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;UPDATE plch_products&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SET product_name = v_product_name, stage = 40;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;With this variation, the rounding happens within the PL/SQL assignment. The rounded value is used in both the insert and the update, so the latter will succeed. Moreover, if someone passes an excessively large product name to the procedure, this will get picked up on the relevant assignment line, rather than in the execution of the update statement.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Personally, I prefer the assignment statements to happen after the BEGIN, rather than assigning the value in the declaration section. This allows for any exceptions to be caught in the local exception handler. The disadvantage is that you can't use a CONSTANT.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-3828759403669420812?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/3828759403669420812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=3828759403669420812' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3828759403669420812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3828759403669420812'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/implicit-rounding-on-insert.html' title='Implicit rounding on INSERT'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-3832150858252031043</id><published>2011-03-29T19:30:00.001+11:00</published><updated>2011-03-29T19:30:02.133+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Everything happened at once</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Okay, it has taken around 14 billion years for everything to happen so far, and there's still a lot more to go. However I'm interested in the concept of 'time' in Oracle terms.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;u&gt;Redo log sequence&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;In a single Oracle instance, the redo log views everything as a sequence with one change after the other. Only in a RAC setup can you have multiple instances of the same database doing things simultaneously. Outside of&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;recovery we are not too fussed with the redo log.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;u&gt;Concurrent Activity&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Individual Oracle sessions can make changes to separate data blocks concurrently, though you are limited by the number of CPU cores (because only the CPU can actually process instructions to read or change a block). You can even configure multiple DBWR processes so that you can write multiple blocks to disk at the same time. Again, you might be throttled by the hardware of spindles and disk heads.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;u&gt;System Change Number&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Bridging the gap between the redo log and the 'parallel' activity of the database is the SCN. Every commit increments the SCN, plus it gets incremented every &lt;a href="http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/flashptr003.htm#sthref608"&gt;three seconds&lt;/a&gt; even without a commit. The &lt;a href="http://download.oracle.com/docs/cd/E14072_01/server.112/e10713/process.htm#BABJEHBC"&gt;LGWR&lt;/a&gt;&amp;nbsp;also writes at least every three seconds. Coincidence ?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;u&gt;Flashback Query&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;If your transaction performs three inserts then all three inserts may be under the same SCN or they may be under different SCNs depending on the activity in other sessions, and the time taken between those inserts.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Since you can't match an SCN to points in a transaction, Oracle sensibly decided to keep things simple and return the &lt;a href="http://download.oracle.com/docs/cd/B13789_01/appdev.101/b10795/adfns_fl.htm#1008580"&gt;COMMITTED&lt;/a&gt; state of the data as it was at the SCN. That was the key for my Challenge &lt;a href="http://www.plsqlchallenge.com/pls/apex/f?p=10000:651:618407493716578::NO::P651_QUIZ_ID:2103"&gt;question&lt;/a&gt; earlier this month.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;In some ways, you can view a flashback query as a very lightweight autonomous transaction that only permits reads.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;u&gt;Undo sequencing&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Within a transaction there is a sequence of changes, and you can 'navigate' that sequence using SAVEPOINT and ROLLBACK.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;This navigation walks back through UNDO to reverse the sequence of operations within a transaction.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;SAVEPOINT doesn't affect the SCN, so flashback can't be used to look at a table as it was when a SAVEPOINT was issued. All you can do is &amp;nbsp;rollback to a savepoint, and once you've done that you can't rollforward again.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;In theory you could walk back through the undo blocks to see everything the transaction did. If you could do that, you'd also be able to tell what records are locked by the transaction. But I haven't heard of any tools that support this in practice. There's no SQL to access undo directly, and the undo blocks are not necessarily written to disk as you'd find in a redo log, but nor are they guaranteed to still be in the SGA (though they would be in one or the other).&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-3832150858252031043?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/3832150858252031043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=3832150858252031043' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3832150858252031043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3832150858252031043'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/everything-happened-at-once.html' title='Everything happened at once'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-6845968530921591588</id><published>2011-03-26T11:30:00.003+11:00</published><updated>2011-03-28T09:24:43.831+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>An exceptional question for the optimizing compiler</title><content type='html'>I thought about submitting this as a PL/SQL Challenge quiz, but decided it was unfair, undocumented and unhelpful.&lt;br /&gt;&lt;br /&gt;Consider the following procedure&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;create or replace procedure plch_test is&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_num &amp;nbsp; number(1);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_date &amp;nbsp;date;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;e_no_day_for_month exception;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;pragma exception_init(e_no_day_for_month, -1839);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;begin&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;for i in reverse 1 .. 30 loop&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;v_date := to_date(i||'-02-2011','dd-mm-yyyy');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;v_num := 10;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dbms_output.put_line(v_num||':'||v_date);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;end loop;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;exception&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;when e_no_day_for_month then&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dbms_output.put_line('Date error');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;when value_error then&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dbms_output.put_line('Num error');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;end;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;Then I execute it twice with different optimization settings. What error is returned for the executions ?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;alter session set plsql_optimize_level =0;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;alter procedure plch_test compile;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;exec plch_test;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;alter session set plsql_optimize_level =2;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;alter procedure plch_test compile;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;exec plch_test;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the first case, with no optimization, the "date error" path is taken as there isn't a 30th of February.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the second case, you may wonder what effect the optimization might have. The assignment of the number 10 to v_num doesn't need to be in the loop. This isn't a cursor loop or a WHILE loop, so the code inside the loop is guaranteed to be executed. If it was executed once prior to entering the loop, it would result in a value_error.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In fact, a date error is still returned. Possibly there is no such optimization. Or possibly it is done in a way that means it is only executed once, in the correct sequence, but is not repeated. Tests shown in &lt;a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:588234700346069527"&gt;AskTom&lt;/a&gt;&amp;nbsp;indicate that there is some optimization happening.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ultimately, the PL/SQL optimizing compiler is a black box. It would be nice to assume that it wouldn't change the behaviour of the code. But I can't help looking at the procedure and wondering, would it be "wrong" (or more specifically a bug) if an optimization switched it to return a value error.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-6845968530921591588?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/6845968530921591588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=6845968530921591588' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6845968530921591588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6845968530921591588'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/exceptional-question-for-optimizing.html' title='An exceptional question for the optimizing compiler'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-3171003552370667586</id><published>2011-03-17T19:22:00.002+11:00</published><updated>2011-03-17T19:22:00.248+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='odtug'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Monitoring with Images and Slugs</title><content type='html'>After my &lt;a href="http://blog.sydoracle.com/2011/03/blogging-jeopardy.html"&gt;Blogging Jeopardy!&lt;/a&gt; post, &amp;nbsp;John &lt;a href="http://only4left.jpiwowar.com/"&gt;Piwowar&lt;/a&gt;&amp;nbsp;recommend I use FeedBurner to better keep count of my audience. My blind spot is aggregators. I'm very happy to have my content aggregated, and it goes out through &lt;a href="http://pulse.oradbpedia.com/blog/"&gt;OraDBPedia&lt;/a&gt;, &lt;a href="http://orana.info/category/dbd/"&gt;OraNA&lt;/a&gt;, &lt;a href="http://www.orafaq.com/aggregator"&gt;OraFAQ&lt;/a&gt; and probably some others too. Those aggregators pick up my feed, extract the records (content and metadata, such as author and date posted) and merge it into their feed. And people pick up that merged feed without ever touching the original feed, and that's where I lose track of them.&lt;br /&gt;&lt;br /&gt;But images are magic. In an RSS feed, images are just a URL. The actual image data has to picked up by the end viewer. My images go through Picasa, as all my blog/website stuff is tied up in Google. Picasa tells me that an image in a recent post of mine was downloaded about 400 times, indicating that post had about that many viewers.&lt;br /&gt;&lt;br /&gt;A similar tactic is exploited by mass mailers. When your email client talks about blocking remote content, it is probably talking about images, though Javascript libraries and CSS files are another, more dangerous, culprit. But outside of the security aspect, the email client &amp;nbsp;warns you about 'privacy'. That is because there is a good chance that the image is being used to track whether you opened the email.&lt;br /&gt;&lt;br /&gt;If I do a mass email to Tom, Dick and Harry, I can include a unique image URL in each one, in the same way as I address them individually with &lt;a href="http://thedailywtf.com/Articles/Similar-to-Snail-Mail.aspx"&gt;Dear Slug&lt;/a&gt;. I'll obfuscate it a bit to hide the fact, but essentially I'll have src="http://images.sydoracle.com/mailImage?id=Tom" If Tom wants to see the image, he has to get the content by calling the URL which tells me that Tom's message has been opened.&lt;br /&gt;&lt;br /&gt;In my Oracle focussed world, I'd have one table of 'email templates' (with the HTML text and image data as CLOB and BLOB respectively), one 'subscriber' table with names and email addresses, and an 'email' table representing the many-to-many between the two. The email table would have the personalized URL. I'd use the Apex Listener to supply images in the same way as I did for &lt;a href="http://blog.sydoracle.com/2011/03/listening-for-my-pdfs.html"&gt;PDFs&lt;/a&gt;, but this time I'd use a procedure. The listener calls the procedure, which picks the email via the personalized URL, marks it as read and then returns the actual image data from the parent email template.&lt;br /&gt;&lt;br /&gt;If anyone wants an itty-bitty Apex app for that, let me know through a comment (or twitter, email or LinkedIn...) 11.2.0.2 (maybe we should call it 11gR2d2) added&amp;nbsp;&lt;a href="http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/u_smtp.htm#BABJBFGH"&gt;SSL for UTL_SMTP&lt;/a&gt;, making it a better option for sending out emails. Whether the XE version will have that remains to be seen. Anything I have would use the old, unencrypted technique.&lt;br /&gt;&lt;br /&gt;PS.&lt;br /&gt;If anyone doubts the approach of having the image data in the database, I can recommend Marcelle's ODTUG webinar on "&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: x-small; line-height: 15px;"&gt;Audio &amp;amp; Video Management Using PL/SQL".&lt;/span&gt;&amp;nbsp;The ODTUG webinars are recorded and you get the URL if you are registered for the webinar. Not sure if I'm allowed to post the URL, but you could ask&amp;nbsp;&lt;a href="http://eternal-donut.blogspot.com/"&gt;Marcelle&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-3171003552370667586?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/3171003552370667586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=3171003552370667586' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3171003552370667586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/3171003552370667586'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/monitoring-with-images-and-slugs.html' title='Monitoring with Images and Slugs'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-447798955113878555</id><published>2011-03-13T19:00:00.002+11:00</published><updated>2011-03-13T19:00:00.240+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Blogging Jeopardy!</title><content type='html'>Please phrase your article in the form of a question.&lt;br /&gt;&lt;br /&gt;I'm not quite sure how many people read my blog (&lt;span style="font-size: xx-small;"&gt;see footnote&lt;/span&gt;). I can be sure that about a thousand people take the &lt;a href="http://www.plsqlchallenge.com/"&gt;PL/SQL Challenge&lt;/a&gt; every working day. They take the time to visit the site, read the question, &lt;u&gt;think about it&lt;/u&gt; and come up with an answer. I assume most will actually check the correct answer the next day (and maybe think about that too). So if I can phrase my article or concept &lt;a href="http://en.wikipedia.org/wiki/Jeopardy%21"&gt;in the form of a question&lt;/a&gt; for the Challenge, I can reach a much wider audience that I do through my blog. And they will think about what I wrote.&lt;br /&gt;&lt;br /&gt;So far I've had &lt;a href="http://www.plsqlchallenge.com/pls/apex/f?p=10000:651:2932712678939982::NO::P651_QUIZ_ID:1942"&gt;one question published&lt;/a&gt; (25th of Jan 2010), taken by 1090 people with a typical time of 2 minutes and about two thirds got it all correct. And about 200 submitted a survey afterwards. That is a lot of eyeballs. I've got another one coming soon and I recently submitted a third.&lt;br /&gt;&lt;br /&gt;So if you've got something you want people to know, whether you have an existing blog or not, if you can phrase it in the form of a PL/SQL question, go submit it. Alternatively, just go and play. The challenge awaits. &lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Footnote:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Google Analytics talks of about a thousand page views last month (though  misses a week when I did something and lost my old stats). Blogger  stats says about 2,700 which is more comforting. I expect some will pick  me up through an aggregator and won't get counted and I'm not sure if a  bunch of people who take my feed online, eg though Google Reader, are  counted individually or not.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-447798955113878555?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/447798955113878555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=447798955113878555' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/447798955113878555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/447798955113878555'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/blogging-jeopardy.html' title='Blogging Jeopardy!'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-7237897054079776421</id><published>2011-03-12T18:50:00.002+11:00</published><updated>2011-03-15T14:28:25.108+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Why I don't trust deferrable constraints</title><content type='html'>I don't like deferred constraints. I don't like deferrable constraints either, because there is the risk of someone making them deferred.&lt;br /&gt;&lt;br /&gt;There's a Pythian blog on one potential &lt;a href="http://www.pythian.com/news/9881/deferrable-constraints-in-oracle-11gr2-may-lead-to-logically-corrupted-data/"&gt;corruption&lt;/a&gt; pitfall where you can end up with duplicate primary keys.&lt;br /&gt;&lt;br /&gt;A little over a year ago, I commented on a &lt;a href="http://antognini.ch/2010/01/join-elimination/"&gt;blog&lt;/a&gt; by Chrisian Antognini to demonstrate where the optimizer gives incorrect results by invalid table elimination with a deferred constraint.&lt;br /&gt;&lt;br /&gt;I've recently retested this in the 11.2.0.2 environment on apex.oracle.com and seen a change in&amp;nbsp;behavior, though the bug is still there.&lt;br /&gt;&lt;br /&gt;Firstly, create the parent and child tables, linked by a deferrable constraint that is INITIALLY IMMEDIATE (ie not deferred by default).&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE TABLE t1 (&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;id NUMBER NOT NULL,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;val varchar2(5),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; CONSTRAINT t1_pk PRIMARY KEY(id)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE TABLE t2 (&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; id NUMBER NOT NULL,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; t1_id NUMBER NOT NULL,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; val varchar2(5),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; CONSTRAINT t2_pk PRIMARY KEY(id),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; CONSTRAINT t2_t1_fk FOREIGN KEY (t1_id) REFERENCES t1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;deferrable initially immediate&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then add a view to encapsulate the join&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE VIEW v12 AS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;SELECT t1.id AS t1_id, t1.val AS t1_val,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;t2.id AS t2_id, t2.val AS t2_val, t2.t1_id AS t2_par_t1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;FROM t1, t2&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;WHERE t1.id = t2.t1_id;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Because I was testing on the apex.oracle.com instance, I needed to do it as a single request (because the web-based SQL Worksheet treats a request as a transaction). So I used a stored procedure.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE PROCEDURE test_v AS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;--&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;EXECUTE IMMEDIATE 'alter session set constraints=deferred';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;INSERT INTO t2 (id, t1_id, val) VALUES (10,2,'Child');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;--&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;FOR i IN (SELECT t2_id, t2_val, t2_par_t1 FROM v12) LOOP&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DBMS_OUTPUT.PUT_LINE('1:'||i.t2_id||'/'||i.t2_val||&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'/'||i.t2_par_t1);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;END LOOP;&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;--&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;FOR j IN (SELECT t1_id FROM v12) LOOP&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DBMS_OUTPUT.PUT_LINE('2:'||j.t1_id);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;END LOOP;&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;--&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;FOR k IN (SELECT t1_id, t1_val FROM v12) LOOP&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DBMS_OUTPUT.PUT_LINE('3:'||k.t1_id||'/'||k.t1_val); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;END LOOP;&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;--&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;ROLLBACK;&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;--&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The procedure sets the transaction to use deferred constraints, then inserts a row into the child table (without the corresponding parent row). Then there are three selects taking different columns from the view.&lt;br /&gt;&lt;br /&gt;The first loop picks details that exist only in the child table, the second picks the common identifier and the third picks up details from the parent table.&lt;br /&gt;&lt;br /&gt;In XE, only first loop returns records, but the second and third do not. The first loop "works" because the join to the parent table is eliminated on the assumption that the constraint requires that a parent row exists.&lt;br /&gt;&lt;br /&gt;In 11.2.0.2, the first and second loops return records. The second loop can work if you assume that, because the ids are common, then it makes no logical difference if you take it from the child table or the parent table. If you assume the parent table will have at most one row for the key then the number of records returned is fully dependent on the child table. It is therefore more efficient to just hit the child table, and it is am improvement to eliminate the join to the parent.&lt;br /&gt;&lt;br /&gt;In neither situation does the third query return a row. Because it requires the parent table to be hit, the optimizer cannot eliminate it and when it is hit, it is found to be empty.&lt;br /&gt;&lt;br /&gt;Ultimately, the 'solution' would require every cursor to have additional dependencies on the state of every deferrable constraint for the query...or to simply assume that any constraint that is deferrable might be deferred and to optimize it as if it doesn't exist.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-7237897054079776421?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/7237897054079776421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=7237897054079776421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7237897054079776421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7237897054079776421'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/why-i-dont-trust-deferrable-constraints.html' title='Why I don&apos;t trust deferrable constraints'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-1754445079738468110</id><published>2011-03-11T19:45:00.000+11:00</published><updated>2011-03-11T19:45:01.591+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>DBAs and Developers - complementary skill sets</title><content type='html'>This is a comment on one slide from &lt;a href="http://www.nocoug.org/download/2011-02/Optimizing-%28slides%29.pptx.pdf"&gt;Cary Millsap's NoCoug presentation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The slide showed the skill sets needed by Developers and DBAs. He suggested that there was a partial intersection in skills.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: medium none;"&gt;&lt;tbody&gt;&lt;tr&gt;   &lt;td style="border: 1pt solid windowtext; color: blue; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;DBAs&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; color: blue; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;Developers&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;Operations&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;Algorithms&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;Resource management&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;Languages&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;Troubleshooting&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;Frameworks&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;Physical data design&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;Design&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;System interfaces&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;User interfaces&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;Data modeling&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;Data modeling&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;SQL optimizer&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;Debugging, profiling, tracing&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 133pt;" valign="top" width="177"&gt;&lt;div class="MsoNormal"&gt;Oracle product features&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 6cm;" valign="top" width="227"&gt;&lt;div class="MsoNormal"&gt;Business-domain processes&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Personally, I'd match up the developer's Debugging skill against the  DBAs Troubleshooting. Both are forms of problem resolution, but the  developer's focus will be on algorithm/process with the DBA responsible  for the Operations.&lt;br /&gt;&lt;br /&gt;I like the thought that both need to understand data modelling. I'm not convinced where the Developer's responsibility for the data model passes to the DBA, or whether there is an analyst/architect/designer column missing. It probably varies between organizations. DBAs are definitely responsible for tablespaces and file concepts. Constraints and indexes fall into a DMZ between the two. I recall getting into a heated discussion with HJR on the old Dizwell forums about whether the DBA should be able to make constraints deferrable by default. I still think constraints are a 'logical' concept arising from the business model. &lt;br /&gt;&lt;br /&gt;System interfaces are about the only other area I'd be fuzzy on. I'd still put these as heavily 'business/process' constructs that sit with the developers.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Any major skill sets missed ? Anything in the wrong box ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-1754445079738468110?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/1754445079738468110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=1754445079738468110' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1754445079738468110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/1754445079738468110'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/dbas-and-developers-complementary-skill.html' title='DBAs and Developers - complementary skill sets'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-6741315532218351095</id><published>2011-03-10T19:10:00.032+11:00</published><updated>2011-03-10T19:10:01.740+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Listening for my PDFs</title><content type='html'>After the last &lt;a href="http://blog.sydoracle.com/2011/03/using-oracle-to-convert-pdf-to-html.html"&gt;post&lt;/a&gt; I had some PDFs in my database. I therefore took advantage of the opportunity to user the &lt;a href="http://www.oracle.com/technetwork/developer-tools/apex-listener/overview/index.html"&gt;Apex Listener&lt;/a&gt; to get them out. It can just as easily serve up images, video, audio and all manner of other files.&lt;br /&gt;&lt;br /&gt;I used the standalone mode. That means I downloaded the listener, and just ran it, through java, from the command line. No tomcat, glassfish or any other application server involved. I used port 8083 as I was running on the same machine as the database and already had the embedded gateway listening on 8080.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;java -Dapex.port=8083 -Dapex.images=D:\oraclexe\apex\images -Dapex.erase=true -jar d:\oraclexe\apexlistener\apex.war&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;'Install' is pretty much down to setting a couple of passwords to start it up.&lt;br /&gt;&lt;br /&gt;Then go to the admin screen and point it at an Oracle install just as you would any other client. In the database I had to unlock APEX_PUBLIC_USER, and make sure it had grants to the table I wanted to use. I could have used another username/password though. I could have several listeners running on different ports attached to different schemas.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-4V_SK2XlBfI/TXhgJc0DcWI/AAAAAAAAAGw/fjKRTiWyvII/s1600/apex_l_admin.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="225" src="https://lh5.googleusercontent.com/-4V_SK2XlBfI/TXhgJc0DcWI/AAAAAAAAAGw/fjKRTiWyvII/s400/apex_l_admin.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Then switch to the Resource Template tab, enter the URL and query and set the &lt;u&gt;Type&lt;/u&gt; to &lt;u&gt;Media Resource&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-LPNcsuNdxyg/TXhdz9-CUZI/AAAAAAAAAGs/XaQP5hDbgQE/s1600/apex_l_screen.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="210" src="https://lh6.googleusercontent.com/-LPNcsuNdxyg/TXhdz9-CUZI/AAAAAAAAAGs/XaQP5hDbgQE/s400/apex_l_screen.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;Downloading the file is just a matter of putting the filename in the URL. Of course in a real application, there would be a proper sequence generated primary key rather than a filename. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue; font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;http://127.0.0.1:8083/apex/pdf?filename=NoCOUG_Journal_200602.pdf&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I ran the browser on the same machine too, but that isn't necessary or normal. The database can be sitting listening on 1521 on machine "Blue", the apex  listener on machine "Green" connected to the database on 1521 and  listening on 8083, and the browser can run on machine "Red" and just  talk to "Green" on 8083.&lt;br /&gt;&lt;br /&gt;In an XE environment you might run the Apex Listener on the same machine as the database (as XE is limited to 1 CPU and 1 GB of memory, so even a basic machine still has resources spare). This is actually quite secure as you can use the firewall to shut off port 1521 from external machines, forcing all database activity through a more controlled and less privileged account, just RESTful APIs through the URL.&lt;br /&gt;&lt;br /&gt;Hey, that could take off. Just need a cool name for accessing a database as a service with no SQL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-6741315532218351095?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/6741315532218351095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=6741315532218351095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6741315532218351095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/6741315532218351095'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/listening-for-my-pdfs.html' title='Listening for my PDFs'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh5.googleusercontent.com/-4V_SK2XlBfI/TXhgJc0DcWI/AAAAAAAAAGw/fjKRTiWyvII/s72-c/apex_l_admin.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-7424648299289363354</id><published>2011-03-08T18:59:00.004+11:00</published><updated>2011-03-09T15:20:58.152+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Using Oracle to convert PDF to HTML</title><content type='html'>&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;I've used Oracle Text on a couple of assignments. One of the handy things it can do is convert a PDF into an HTML or plain text document. Actually, you can do this sort of thing through Google Docs too, by uploading a PDF and saving it back to your desktop as a different file type. But I'm going to demo the Oracle mechanism.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Firstly, you need an Oracle directory. You may already have one. If not, your DBA will need to create it as the CREATE ANY DIRECTORY privilege is needed and this is one of those &lt;u&gt;very&lt;/u&gt; dangerous privileges that a cautious DBA will keep under lock and key. If, like me, you are using a personal XE environment, you can do what you want.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;create or replace directory pdf_files&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; as&lt;/span&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;'&lt;u&gt;&lt;b&gt;WHATEVER YOUR SOURCE DIR IS&lt;/b&gt;&lt;/u&gt;';&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;grant all on directory pdf_files to public;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;The next step is a table to store the PDF in (as a BLOB) and the appropriate Oracle Text index.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;create table ctx_demo&lt;br /&gt;&amp;nbsp; (filename varchar2(30),&lt;br /&gt;&amp;nbsp;&amp;nbsp; text blob)&lt;br /&gt;/&lt;br /&gt;create index search_idx&lt;br /&gt;&amp;nbsp; on ctx_demo (text)&lt;br /&gt;&amp;nbsp; indextype is ctxsys.context&lt;br /&gt;&amp;nbsp; parameters ('sync (on commit)')&lt;br /&gt;/&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;The third step is a few simple procedures. One to store the file in the blob, the second to get the converted HTML as a CLOB, and the final procedure to write the CLOB as a file. In practice, they'd live happily together in a package.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;create or replace procedure load_file&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; (i_filename in varchar,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; i_dirname in varchar2 default 'PDF_FILES')&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;is&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; l_blob blob;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; l_bfile bfile;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;begin&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; insert into ctx_demo (filename, text)&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; values ( i_filename, empty_blob() )&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; returning text into l_blob;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; l_bfile := bfilename( i_dirname, i_filename );&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; dbms_lob.fileopen( l_bfile );&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; dbms_lob.loadfromfile&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (l_blob, l_bfile, dbms_lob.getlength( l_bfile ) );&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; dbms_lob.fileclose( l_bfile );&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;end;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;create or replace function get_html&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; (i_filename in varchar2) return clob&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;is&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_rowid rowid;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_res clob;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;begin&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; select rowid into v_rowid&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; from ctx_demo&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; where filename = i_filename;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; --&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; CTX_DOC.FILTER(index_name =&amp;gt; 'SEARCH_IDX',&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; textkey =&amp;gt; v_rowid,&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; restab =&amp;gt; v_res,&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; plaintext =&amp;gt; false);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return v_res;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;end;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;create or replace procedure write_html&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; (i_filename in varchar2)&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;is&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_clob&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clob;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_out_file UTL_FILE.file_type;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_buffer&amp;nbsp;&amp;nbsp; VARCHAR2(16000);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_amount&amp;nbsp;&amp;nbsp; BINARY_INTEGER := 8000;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_pos&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTEGER := 1;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_clob_len INTEGER;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;begin&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_clob := get_html(i_filename||'.pdf');&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_clob_len := DBMS_LOB.getlength(v_clob);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; v_out_file := UTL_FILE.fopen('PDF_FILES',&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i_filename||'.html', 'w', 32767);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; WHILE v_pos &amp;lt;&amp;gt; v_clob_len LOOP&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; &amp;nbsp; DBMS_LOB.read (v_clob, v_amount, v_pos, v_buffer);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UTL_FILE.put(v_out_file, v_buffer);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UTL_FILE.fflush(v_out_file);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; v_pos := v_pos + v_amount;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; END LOOP;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; UTL_FILE.fclose(v_out_file);&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;END;&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/&lt;/span&gt;&lt;br style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Once all the preparation is done, it is a simple matter of loading the PDF and saving the html.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;For this demo, I'm using an old NoCoug journal, as they &lt;a href="http://tkyte.blogspot.com/2011/02/getting-started.html#c5772556893770027251"&gt;recently loaded&lt;/a&gt; issues for the past ten years. If you are interested in the complete collection, I've got the links listed on my &lt;a href="http://www.sydoracle.com/forums-and-community/nocoug_journal"&gt;NoCoug Journal&lt;/a&gt;  page. Using XE, this conversion only works up to the August 2006 issue.  The later ones (except for February 2009) don't get any useful output.  Possibly a later Oracle edition would cope better with these PDFs. I'm crossing my fingers that the Easter Bunny will bring me a chocolate covered XE 11g.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: red; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;begin&lt;br /&gt;&amp;nbsp; load_file('NoCOUG_Journal_200605.pdf');&lt;br /&gt;&amp;nbsp; write_html('NoCOUG_Journal_200605');&lt;br /&gt;&amp;nbsp; commit;&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Remember PDFs aren't designed to be reverse engineered to HTML documents, and Oracle Text is just interested in the text, so there aren't any pictures.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-7424648299289363354?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/7424648299289363354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=7424648299289363354' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7424648299289363354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/7424648299289363354'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/using-oracle-to-convert-pdf-to-html.html' title='Using Oracle to convert PDF to HTML'/><author><name>Gary Myers</name><uri>https://profiles.google.com/102181347552792364408</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-JOFVsyx3ZJg/AAAAAAAAAAI/AAAAAAAAADo/SWki7DHv2o4/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-8226190250925496693</id><published>2011-03-05T08:04:00.000+11:00</published><updated>2011-03-05T08:04:10.489+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>How do I filter data when doing an import or export</title><content type='html'>When you need a subset of data for testing, it is very useful to be able to specify the filtering in the export or import. That's a lot easier than copying a full dataset and waiting while it deletes most if it.&lt;br /&gt;&lt;br /&gt;This is very easy using the Datapump tools in 10g. Both expdb and impdb have the facility to accept a filter criteria. As a quick example:&lt;br /&gt;&lt;br /&gt;Step 1 - Create the table. It has 16,000 rows (roughly)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;sqlplus gary/gary&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL*Plus: Release 10.2.0.1.0 - Production&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; create table bunch_of_data&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;2 &amp;nbsp;as select owner, table_name, column_name, data_type&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;3 &amp;nbsp;from all_tab_columns;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; select count(*) from bunch_of_data;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;COUNT(*)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;----------&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; 16346&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Step 2. Export a subset of the data&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;expdp userid=gary/gary dumpfile=bunch.dmp directory=ext_tables&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; tables=BUNCH_OF_DATA &lt;b&gt;query='WHERE DATA_TYPE=''DATE''&lt;/b&gt;'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Export: Release 10.2.0.1.0 - Production on Friday, 04 March, 2011 17:45:17&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Copyright (c) 2003, 2005, Oracle. &amp;nbsp;All rights reserved.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Starting "GARY"."SYS_EXPORT_TABLE_01": &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&amp;nbsp;userid=gary/******** dumpfile=bunch.dmp&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&amp;nbsp;directory=ext_tables tables=BUNCH_OF_DATA&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&amp;nbsp;query='WHERE DATA_TYPE=''DATE'''&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Estimate in progress using BLOCKS method...&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Processing object type TABLE_EXPORT/TABLE/TABLE_DATA&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Total estimation using BLOCKS method: 1024 KB&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Processing object type TABLE_EXPORT/TABLE/TABLE&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;. . exported "GARY"."BUNCH_OF_DATA" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30.10 KB &amp;nbsp; &amp;nbsp; 513 rows&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Master table "GARY"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;******************************************************************************&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Dump file set for GARY.SYS_EXPORT_TABLE_01 is:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&amp;nbsp;&amp;nbsp;D:\APPS\AR122007\BUNCH.DMP&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Job "GARY"."SYS_EXPORT_TABLE_01" successfully completed at 17:46:00&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Step 3. Import a subset of that export (into another schema in this test)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;impdp userid=gary_dba/gary dumpfile=bunch.dmp&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;directory=ext_tables&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tables=BUNCH_OF_DATA&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;query='WHERE OWNER = ''SYSTEM'''&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;remap_schema=gary:gary_dba&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Import: Release 10.2.0.1.0 - Production on Friday, 04 March, 2011 17:46:02&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Copyright (c) 2003, 2005, Oracle. &amp;nbsp;All rights reserved.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Master table "GARY_DBA"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Starting "GARY_DBA"."SYS_IMPORT_TABLE_01": &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&amp;nbsp;&amp;nbsp;userid=gary_dba/******** dumpfile=bunch.dmp directory=ext_tables&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&amp;nbsp;&amp;nbsp;tables=BUNCH_OF_DATA&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&amp;nbsp;&amp;nbsp;query='WHERE OWNER = ''SYSTEM''' remap_schema=gary:gary_dba&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Processing object type TABLE_EXPORT/TABLE/TABLE&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Processing object type TABLE_EXPORT/TABLE/TABLE_DATA&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;. . imported "GARY_DBA"."BUNCH_OF_DATA" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30.10 KB &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 out of 513 rows&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Job "GARY_DBA"."SYS_IMPORT_TABLE_01" successfully completed at 17:46:11&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Partial export and partial import all complete.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-8226190250925496693?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/8226190250925496693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=8226190250925496693' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8226190250925496693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8226190250925496693'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/how-do-i-filter-data-when-doing-import.html' title='How do I filter data when doing an import or export'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-288641586828643040</id><published>2011-03-02T19:00:00.025+11:00</published><updated>2011-03-02T19:00:17.305+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>FOR EACH ROW trigger fires *at least* once per row</title><content type='html'>I have a table with a&amp;nbsp;'BEFORE UPDATE FOR EACH ROW' trigger.&lt;br /&gt;The table has just&amp;nbsp;one row and I update that row a thousand times. How many times does the trigger fire ?&lt;br /&gt;&lt;br /&gt;It depends...though I'm not sure on what. This was the basis for one of Steven Feuerstein's &lt;a href="http://www.plsqlchallenge.com/"&gt;PL/SQL Challenge&lt;/a&gt; &lt;a href="http://plsql-challenge.blogspot.com/2011/02/dml-restarts-only-happen-with.html"&gt;questions&lt;/a&gt;. Here's a demonstration.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;DROP TABLE plch_employees purge;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE TABLE plch_employees&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;( &amp;nbsp;employee_id &amp;nbsp; INTEGER&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;, salary &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NUMBER)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO plch_employees VALUES (100, 0);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE PACKAGE plch_emp_count&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;IS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; g_count NUMBER;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END plch_emp_count;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE TRIGGER plch_employee_changes&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; BEFORE UPDATE&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; ON plch_employees&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; FOR EACH ROW&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; plch_emp_count.g_count := plch_emp_count.g_count + 1;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CREATE OR REPLACE FUNCTION f_trg_test&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;(i_iterations IN NUMBER default 1000000)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;RETURN VARCHAR2 IS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_ret varchar2(100);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_cnt number := 1;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;plch_emp_count.g_count := 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;WHILE v_cnt &amp;lt; i_iterations LOOP&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;UPDATE plch_employees&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SET salary = salary + 1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WHERE employee_id = 100;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;IF plch_emp_count.g_count &amp;gt; v_cnt THEN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;v_ret := 'MisMatch at :'||v_cnt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;v_cnt := i_iterations;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;END IF;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;v_cnt := v_cnt + 1;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;END LOOP;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;v_ret := NVL(v_ret, 'Reached '||plch_emp_count.g_count);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;commit;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;return v_ret;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;set serveroutput on&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;exec dbms_output.put_line(f_trg_test);&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When I run it on my XE instance, I get a mismatch, generally after 718 rows.&amp;nbsp;I get another, smaller, peak at 11518. These indicate a restart which is discussed in a couple of Tom Kyte posts listed &lt;a href="http://asktom.oracle.com/pls/asktom/f/f?p=100:11:0::::P11_QUESTION_ID:237924300346045037"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In summary a restart is where the session has found a row that needs update, fires the row trigger, then tries to update the row...and doesn't. It then retries the update, finding the row again and succeeds.&amp;nbsp;&lt;/div&gt;&lt;div&gt;Apparently there is some &lt;a href="http://plsql-challenge.blogspot.com/2011/02/dml-restarts-only-happen-with.html"&gt;discussion&lt;/a&gt; about 'single-session' restarts being related to UNDO.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'll leave the reasons open. But it is worth remembering that with a BEFORE UPDATE trigger, FOR EACH ROW means it will fire &lt;b&gt;at least&lt;/b&gt; once for each row, not &lt;b&gt;exactly&lt;/b&gt;&amp;nbsp;once.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-288641586828643040?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/288641586828643040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=288641586828643040' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/288641586828643040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/288641586828643040'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/for-each-row-trigger-fires-at-least.html' title='FOR EACH ROW trigger fires *at least* once per row'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2911848262052346511</id><published>2011-03-01T19:00:00.003+11:00</published><updated>2011-03-01T19:00:05.892+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Keep the faith</title><content type='html'>A frequent query request is that, when you've used MAX or MIN to find the highest, latest or otherwise most favoured row(s), you want the values of the other columns in that row.&lt;br /&gt;&lt;br /&gt;Often a suggested answer is the use of a sub-query. But this overlooks one of those less well known features in Oracle SQL, the KEEP clause.&lt;br /&gt;&lt;br /&gt;Consider the test case:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;create table test_max&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;(id number,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; colour varchar2(20));&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (1,'Red');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (2,'Orange');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (3,'Yellow');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (4,'Green');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (5,'Blue');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (6,'Purple');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (7,'Black');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (8,'White');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (9,'Yellow');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;insert into test_max values (10,'Yellow');&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The maximum value of the 'colour' column is 'Yellow'. To make it a bit trickier, I've included three rows for the colour Yellow, with the IDs 3, 9 and 10. This allows us to see what happens if more than one row matches that maximum value.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select max(colour),&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; min(id) keep (dense_rank last order by colour asc) min_id,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; max(id) keep (dense_rank last order by colour asc) max_id,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; count(id) keep (dense_rank last&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; order by colour asc) cnt_col,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; count(id) keep (dense_rank last&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; order by colour asc, id desc) cnt_id&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;from test_max;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;div&gt;MAX(COLOUR) &amp;nbsp; MIN_ID &amp;nbsp;MAX_ID CNT_COL &amp;nbsp;CNT_ID&lt;/div&gt;&lt;div&gt;------------- ------ ------- ------- -------&lt;/div&gt;&lt;div&gt;Yellow &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;The query tells us that the highest colour is yellow, and of the 'yellow' rows, the lowest id is 3, the highest is 10 and that there are three in total. Whether you use DENSE_RANK LAST and ORDER BY ... ASC or DENSE_RANK FIRST and ORDER BY ... DESC is a readability issue, and should be judged on a case-by-case basis.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The final count demonstrates that, by adding further ordering criteria, it is possible to detail down to an individual result.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you have Tom Kyte's &lt;a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:506531098926174::::P11_QUESTION_ID:15637744429336"&gt;STRAGG&lt;/a&gt; installed, you can use that too. [My own implementation is odd in that I expect the delimiter to be concatenated into the parameter value, rather than coding it into the aggregate function.]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I haven't found a way to pull in the new 11g LISTAGG function which has its own syntactic peculiarites.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;select stragg(id||',') keep (dense_rank last&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; order by colour asc) cnt_col,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; stragg(id||',') keep (dense_rank last&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; order by colour asc, id desc) cnt_id&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;from test_max&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;CNT_COL &amp;nbsp; &amp;nbsp;CNT_ID&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;---------- ----------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;3,9,10, &amp;nbsp; &amp;nbsp;3,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2911848262052346511?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2911848262052346511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2911848262052346511' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2911848262052346511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2911848262052346511'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/03/keep-faith.html' title='Keep the faith'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-2149253453117977277</id><published>2011-02-24T19:00:00.003+11:00</published><updated>2011-02-24T20:36:36.187+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Blekko /oracledb Needs You !</title><content type='html'>Despite popular opinion, there is more than one search engine. And I'm not talking Bing either. I do not use the MS word :) I mean &lt;a href="http://www.blekko.com/"&gt;blekko&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I do admit to being somewhat wedded to Google. I use GMail, Google Reader, Blogger, Sites, Docs. Oh, and the search engine. I'll also admit to once believing that Google Search (or rather, &lt;a href="http://en.wikipedia.org/wiki/AltaVista"&gt;AltaVista&lt;/a&gt;, which was the big one before Google came into the picture) would be doomed to failure. Quite simply, I couldn't see how one site could hold a copy of the entire Internet. I still can't, but they come close enough to managing it.&lt;br /&gt;&lt;br /&gt;Back then, Yahoo was in the picture with a human moderated directory of sites but without the ability to text search within those sites. It wasn't search as it is understood today. Blekko have merged the concept of the directory with the text search aspect, under its concept of &lt;a href="http://blekko.com/ws/+/about"&gt;/slashtags&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Part of the idea, as I understand it, is to keep out content farms and scrapers. &lt;br /&gt;&lt;br /&gt;So a week or so ago, they talked to the folks at StackOverflow (my favorite Q&amp;amp;A forum) to get some of their experts in to organize some &lt;a href="http://blog.stackoverflow.com/2011/02/blekko-and-stack-overflow/"&gt;programming related slashtags&lt;/a&gt;. With a bit of debate, &lt;a href="http://blekko.com/ws/+/view+/blekko/oracledb"&gt;/oracledb&lt;/a&gt; has been set up as "our" slashtag.&lt;br /&gt;&lt;br /&gt;I've put &lt;a href="http://blekko.com/user/sydoracle"&gt;myself&lt;/a&gt; forward (and been accepted) as one editor for the slashtag. I've listed a bunch of useful sites in there which previously lived as my bookmarks or feed sources. &lt;br /&gt;&lt;br /&gt;Please, try some searches on the /oracledb tag. If you find important sites missing, I can add them in if you throw me a comment. Here is the current &lt;a href="http://blekko.com/ws/+/view+/blekko/oracledb"&gt;site list.&lt;/a&gt; And some more reputable editors would be good too. ACEs or Oak Tablers have that extra credibility.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-2149253453117977277?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/2149253453117977277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=2149253453117977277' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2149253453117977277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/2149253453117977277'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/02/blekko-oracdb-needs-you.html' title='Blekko /oracledb Needs You !'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4455391112048505784</id><published>2011-02-21T19:00:00.001+11:00</published><updated>2011-02-22T17:11:26.971+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>When does a foreign key not reference a primary key ?</title><content type='html'>Generally your foreign key will point to the primary key in the parent table. However it is actually possible to point a foreign key to any column, or set of columns, where uniqueness is enforced through a constraint.&lt;br /&gt;&lt;br /&gt;One situation where this may be applicable is a type / subtype on your entities. I'm using the familiar employee, department and orders model as it was used in the &lt;a href="http://stackoverflow.com/questions/5033129/want-to-add-a-check-constraint-using-a-trigger"&gt;Stackoverflow question&lt;/a&gt; that prompted this. Incidentally, the "Subscriber Content" (ie questions, answers and comments) on StackOverflow are all under &lt;a href="http://stackoverflow.com/legal"&gt;licensed as Creative Commons&lt;/a&gt;, so there are no legal issues with copyright as might be &lt;a href="http://hoopercharles.wordpress.com/2011/02/11/on-the-topic-of-copyright/"&gt;experienced elsewhere&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The problem was that of ensuring orders could only be owned by certain types of employees, the salesmen. By the way, is anyone else worried that the abbreviation for Sales and Marketing is S&amp;amp;M. Now if you are a data modeling fundamentalist, you would normalize out 'SALESMAN' as a separate entity from 'EMPLOYEE', with an optional one-to-one relationship. I'm not saying that is the wrong solution, but simply offering an alternative which may offer practical benefits in &lt;u&gt;some&lt;/u&gt; circumstances (eg reduced storage and de-duplication, and maybe tighter consistency in column statistics). &lt;br /&gt;&lt;br /&gt;Firstly, I create the employee table. I add an extra field which is always populated for salesmen, and never for another type of employee. I enforce the value of this to be the same as the employee id, although this is not really essential as long as it is unique. And that uniqueness MUST be enforced by a constraint and not just by an index.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;CREATE TABLE t_emp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; (emp_id number PRIMARY KEY, emp_name varchar2(20),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; dept_name varchar2(10),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; sales_emp_id number,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; CONSTRAINT sales_emp_id_sales_ck CHECK&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((sales_emp_id IS NULL AND dept_name != 'SALES') OR&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (dept_name = 'SALES' AND sales_emp_id = emp_id &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND sales_emp_id IS NOT NULL)),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; CONSTRAINT sales_emp_id_uk UNIQUE (sales_emp_id));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I insert some employees, with the last three expected to fail due to the constraint violation.&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO t_emp VALUES (1,'Alan','SALES',1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO t_emp VALUES (2,'Bill','ACCOUNTS',NULL);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO t_emp VALUES (3,'Chuck','ACCOUNTS',3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO t_emp VALUES (4,'Dan','SALES',NULL);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO t_emp VALUES (5,'Ellen','SALES',6);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;SELECT * FROM t_emp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now I create the ORDERS table. Rather than use the primary key of the EMPLOYEES table, I use the unique salesman's identifier. This ensures that orders can only belong to a salesman.&amp;nbsp; &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;CREATE TABLE t_orders&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; (ord_id number PRIMARY KEY,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; salesman number,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; CONSTRAINT salesman_fk FOREIGN KEY (salesman)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REFERENCES t_emp(sales_emp_id));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Finally, a simple test to show that only the sales employees can own orders.&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO t_orders VALUES (1,1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;INSERT INTO t_orders VALUES (2,2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4455391112048505784?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4455391112048505784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4455391112048505784' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4455391112048505784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4455391112048505784'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/02/when-does-foreign-key-not-reference.html' title='When does a foreign key not reference a primary key ?'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-35869496099706511</id><published>2011-02-18T19:00:00.005+11:00</published><updated>2011-02-18T19:00:07.843+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>A game of Truth and Falsehood ?</title><content type='html'>Here's a quick quiz for you. I create the following table:&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;CREATE TABLE t_truth&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; (truth_id&amp;nbsp;&amp;nbsp; NUMBER NOT NULL,&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; dare_id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER,&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; CONSTRAINT truth_dare_id CHECK (truth_id = dare_id));&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br /&gt;Which of the following statements will successfully insert a row into the table.&lt;br /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;INSERT INTO t_truth VALUES (1,null);&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;INSERT INTO t_truth VALUES (2,2);&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;INSERT INTO t_truth VALUES (3,0);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;&lt;br /&gt;Actually both the first and second statements succeed.&lt;br /&gt;&lt;br /&gt;The check constraint condition "truth_id = date_id" will evaluate to unknown when dare_id is null. The constraint is only violated if the condition fails.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-35869496099706511?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/35869496099706511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=35869496099706511' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/35869496099706511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/35869496099706511'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/02/game-of-truth-and-falsehood.html' title='A game of Truth and Falsehood ?'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-4607269924092349402</id><published>2011-02-12T17:02:00.001+11:00</published><updated>2011-02-22T17:12:21.940+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Because 1.25 isn't actually a number</title><content type='html'>Prompted by a &lt;a href="http://stackoverflow.com/questions/4975395/replace-in-oracle-10g-not-working-as-i-expected-can-anyone-explain"&gt;stackoverflow post&lt;/a&gt;, here's a little demo of the role of NLS_NUMERIC_CHARACTERS in a TO_CHAR.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; alter session set nls_numeric_characters=',.';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Session altered.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; select to_char(1.25) from dual;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;TO_C&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;----&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;1,25&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So what happens ?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Firstly&amp;nbsp;1.25 might be a number to us, it isn't actually a NUMBER. It is a numeric literal representing the value&amp;nbsp;"1 and a quarter". Oracle's first step is to convert it into its internal representation.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SQL&amp;gt; select dump(1.25) from dual;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DUMP(1.25)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;---------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Typ=2 Len=3: 193,2,26&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To paraphrase Crocodile Dundee, "Now, that's a NUMBER". Okay, it's actually the dump of the NUMBER but it is a condition of Australian citizenship that you work a Mick Dundee reference in at least once a year.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The same concept applied to date literals, such as &amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;date '2011-02-13'&amp;nbsp;&lt;/b&gt;&lt;/span&gt;but the 'date' keyword makes it more obvious to us that we are telling Oracle that it is something special.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The NLS values don't play any part in this conversion to the internal format. The internal value itself is NLS neutral so it doesn't have the concept of a period or a comma as a decimal separator.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The NLS settings do play a part in the TO_CHAR conversion from the internal format. That's where the comma is being formatted into the string. If you really want to be sure about the formatting, you can add this to the TO_CHAR, and the matter will be settled once and for all.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;select to_char(1.25,'999.99','NLS_NUMERIC_CHARACTERS=.,') from dual;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-4607269924092349402?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/4607269924092349402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=4607269924092349402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4607269924092349402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/4607269924092349402'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/02/because-125-isnt-actually-number.html' title='Because 1.25 isn&apos;t actually a number'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-8340768651020520060</id><published>2011-02-03T20:34:00.000+11:00</published><updated>2011-02-03T20:34:54.957+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Amazon'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Fluffy white Oracle clouds by the hour</title><content type='html'>Pay-by-the-hour options are becoming more common, with Amazon and Oracle are getting even more intimate in the next few months. Yes, you too will be able to pay for a quickie with the king of databases (or queen if you prefer that as a mental image). &lt;br /&gt;&lt;br /&gt;No prices have been announced, so it will be interesting to see what they come up with. Anyone with their own licenses can still use them. Anyone who is already running Oracle on Amazon would find it easy (and legal) to throw up another one for testing (maybe Real Application Testing, if you've got the money) or perhaps year-end reporting.&lt;br /&gt;&lt;br /&gt;It would also be handy for demos and development outside the scope of the OTN licenses.With the facility to push your &lt;a href="http://download.oracle.com/docs/cd/E14072_01/backup.112/e10643/web_services001.htm"&gt;RMAN backups to the S3 cloud&lt;/a&gt;, you may even have scope for using Amazon as a DR.&lt;br /&gt;&lt;br /&gt;Of course if you're in that group who are chucking terabytes of data around on a daily basis, then your hardware is near and dear to your heart and all this cloud stuff is a load of vapour. And then there's whatever restrictions your application, industry or country has on storing data as bits and bytes floating rounds the US.&lt;br /&gt;&lt;br /&gt;If nothing else, the hourly rates will be interesting to factor in to any future negotiations about licensing for those database servers you don't need running 24x7. &lt;br /&gt;&lt;br /&gt;You can sign up to be &lt;strike&gt;pestered by marketing&lt;/strike&gt; kept informed of developments through the &lt;a href="http://aws.amazon.com/rds/oracle/"&gt;Amazon Oracle page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13265058-8340768651020520060?l=blog.sydoracle.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.sydoracle.com/feeds/8340768651020520060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13265058&amp;postID=8340768651020520060' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8340768651020520060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13265058/posts/default/8340768651020520060'/><link rel='alternate' type='text/html' href='http://blog.sydoracle.com/2011/02/fluffy-white-oracle-clouds-by-hour.html' title='Fluffy white Oracle clouds by the hour'/><author><name>Gary Myers</name><uri>https://profiles.google.com/116132019768637593422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-AcOvwFaIPPo/AAAAAAAAAAI/AAAAAAAABOE/36JTjDn-Oh8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13265058.post-1600986125121371276</id><published>2011-02-01T17:37:00.001+11:00</published><updated>2011-02-22T17:13:34.723+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oradbpedia'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Using Oracle's SERVERERROR to catch unlogged application errors</title><content type='html'>In an ideal world, when an application hits an exception it will write a log message indicating what it was doing and what error was reported.&lt;br /&gt;&lt;br /&gt;In the real world, that doesn't always happen.&amp;nbsp;There are reasons for not showing these details to the user, both from a user-interaction point of view (who wants to see an Oracle error message on a web site) and a security aspect (why tell them what database you use and, potentially, details about table and column structures). They should end up in a log file though.&lt;br /&gt;&lt;br /&gt;But if the application developer's haven't done their job, you can do it for them with a SERVERERROR trigger.&lt;br /&gt;&lt;br /&gt;If the server process returns an error to the client process the trigger is fired. It doesn't fire for "No Rows Returned" or if the error is caught and handled in PL/SQL. If you have a habit of using PL/SQL procedures which return a success/failure parameter with an error message, then stop. It is a bad idea.&lt;br /&gt;&lt;br /&gt;My standard setup includes a table to which I can write debug or log messages.&lt;br /&gt;&lt;br /&gt;I use a sequence generated id as a "key", but also have TIMESTAMP column . I also use a whole bunch of SYS_CONTEXT values as column defaults. I&amp;nbsp;love SYS_CONTEXT defaults. Very handy for tracking batch jobs too.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;REM Create a default sequence for ordering of data&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;CREATE SEQUENCE track_seq;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;REM Create a table to which log text can be written&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;CREATE TABLE track_detail&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; (ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NUMBER,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;TRACK_TIME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TIMESTAMP,&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;DETAIL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VARCHAR2(4000),&lt;/span&gt;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp
