<?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:blogger='http://schemas.google.com/blogger/2008' 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-11839365</id><updated>2017-08-26T08:08:27.807-04:00</updated><title type='text'>The Tom Kyte Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default?alt=atom&amp;start-index=26&amp;max-results=25'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>703</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-11839365.post-1272954424309757072</id><published>2014-01-27T15:54:00.000-05:00</published><updated>2014-01-27T16:08:31.943-05:00</updated><title type='text'>Upcoming Events...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I took some time off from the road at the beginning of 2014 - getting ready to get back on the road again, lots of trips scheduled from February till the end of June. &amp;nbsp;This is just looking at public events for the next three months, hope to see you at one of them!&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://oracle.6connex.com/portal/database2014/login?langR=en_US&amp;amp;mcc=asktom&quot;&gt;Virtual Developer Day &lt;/a&gt;Feb 4th&lt;/h3&gt;&lt;div&gt;I&#39;ll be speaking, along with Jonathan Lewis, about the last 20 years or so of technology and where we think it is all going as part of the &lt;a href=&quot;https://oracle.6connex.com/portal/database2014/login?langR=en_US&amp;amp;mcc=asktom&quot;&gt;Virtual Developer Day&lt;/a&gt; - an entirely online event with many technical speakers. &amp;nbsp;Something to definitely look into!&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://www.rmoug.org/training/training-days-2014-keynote/&quot;&gt;RMOUG&lt;/a&gt;&amp;nbsp;Feb 6th-7th&lt;/h3&gt;At the beginning of February, I&#39;ll be at &lt;a href=&quot;http://www.rmoug.org/training/training-days-2014-keynote/&quot;&gt;RMOUG&lt;/a&gt;&amp;nbsp;Feb 6th and 7th. &amp;nbsp;Truth be told, this won&#39;t be a trip for me - I&#39;m located in Denver, CO now (since the beginning of the year). &amp;nbsp;I will just be returning from Toronto at the beginning of the week (I know all of the best places to go in February!).&lt;br /&gt;&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Ohio Feb 11th-13th&lt;/h3&gt;Of course, if it is February - it must be Ohio. &amp;nbsp;That is the best place to fly into and then drive around in during that month :) &amp;nbsp;I&#39;ll be coming down from Ottawa (another &#39;must see&#39; location in February) and spending &lt;a href=&quot;http://ioug.itconvergence.com/pls/apex/f?p=337:1:7161204406690854&quot;&gt;Feb 11th in Dayton&lt;/a&gt;, &lt;a href=&quot;http://www.gcoug.org/&quot;&gt;Feb 12th in Cincinnati &lt;/a&gt;and the &lt;a href=&quot;http://www.ooug.org/&quot;&gt;13th in Columbus&lt;/a&gt;. &amp;nbsp;Hitting all of the user groups across the state.&lt;br /&gt;&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Real World Performance Netherlands, Germany and Bulgaria Feb 18th-21st&lt;/h3&gt;&lt;div&gt;Then I&#39;m off to continue the Real World Performance tour with Andrew Holdsworth and Graham Wood. &amp;nbsp;This month we are hitting the town of &lt;a href=&quot;http://www.obug.nl/index.php?option=com_k2&amp;amp;view=item&amp;amp;id=71:real-world-performance-tour&amp;amp;Itemid=167&amp;amp;lang=en&quot;&gt;Breda in the Netherlands on the 17th&lt;/a&gt;, &lt;a href=&quot;http://www.doag.org/termine/termine.php?tid=460483&quot;&gt;Munich in Germany on the 18th&lt;/a&gt; and finally &lt;a href=&quot;http://www.bgoug.org/en/events/details/91.html&quot;&gt;Sofia in Bulgria on the 21st.&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://www.hotsos.com/sym14.html&quot;&gt;Hotsos Symposium&lt;/a&gt; Mar 3-6th&lt;/h3&gt;&lt;div&gt;If it is March, then it is definitely time for the &lt;a href=&quot;http://www.hotsos.com/sym14.html&quot;&gt;annual Hotsos Symposium&lt;/a&gt;. &amp;nbsp;I&#39;ll be returning this year with a few sessions. &amp;nbsp;It should be nice and warm in Dallas in March!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Ireland March 11th-12th&lt;/h3&gt;&lt;div&gt;I&#39;ll be in Ireland on March 11th for the I&lt;a href=&quot;http://www.ireland14.oug.org/&quot;&gt;reland OUG conference&lt;/a&gt;. &amp;nbsp;I&#39;ll be speaking on performance and the new In-Memory capabilities coming in Oracle Database 12.1.0.2 soon. &amp;nbsp;On the 12th - I&#39;ll be delivering a &lt;a href=&quot;http://www.ukoug.org/events/oug-ireland-tom-kyte-seminar-2014/&quot;&gt;one day Optimizer Master Class&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Real World Performance London and Latvia&lt;/h3&gt;&lt;div&gt;The tour continues with a date of &lt;a href=&quot;http://www.ukoug.org/2014-events/a-day-of-real-world-performance/&quot;&gt;March 26th in London&lt;/a&gt; and &lt;a href=&quot;http://www.lvoug.lv/Tom-Kyte-and-the-Real-World-Performance-Rock-Stars-Continue-Their-Tour.html&quot;&gt;March 28th in Riga Latvia&lt;/a&gt;. &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Belgrade Serbia, April 1st-2nd&lt;/h3&gt;&lt;div&gt;I&#39;ll post more details when I have them, but I&#39;ll be doing a two day seminar on the optimizer and developer related topics at this time. &amp;nbsp;It will be in conjunction with Oracle University so you can monitor their event website for information soon too.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://collaborate14.ioug.org/&quot;&gt;IOUG Collaborate April 7th-11th&lt;/a&gt;&lt;/h3&gt;&lt;div&gt;I&#39;ll be doing a one day optimizer seminar and four other sessions during the week. &amp;nbsp;&lt;a href=&quot;http://collaborate14.ioug.org/&quot;&gt;April in Las Vegas&lt;/a&gt; - perfect time to be there! &amp;nbsp;And Admin Savage will be speaking too - love the mythbusters!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://www.eastcoastoracle.org/ssl/2013/ocoj/&quot;&gt;Oracle Conference on the James, April 24th&lt;/a&gt;&lt;/h3&gt;&lt;div&gt;I&#39;ll be doing a keynote and a technical session in the morning of the 24th for the &lt;a href=&quot;http://www.eastcoastoracle.org/ssl/2013/ocoj/&quot;&gt;VOUG and HROUG&lt;/a&gt;. &amp;nbsp;Lots of great speakers here - definitely check this out if you are in the Virginia area!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Manila, Philippines - week of April 28th&lt;/h3&gt;&lt;div&gt;I&#39;ll be doing some events in Manila this week - details to follow soon!&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/1272954424309757072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=1272954424309757072' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/1272954424309757072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/1272954424309757072'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2014/01/upcoming-events.html' title='Upcoming Events...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-4432116633494599094</id><published>2013-11-01T12:26:00.000-04:00</published><updated>2013-11-01T12:26:36.181-04:00</updated><title type='text'>All day optimizer event....</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I&#39;ve recently taken over some of the responsibilities of Maria Colgan (also known as the &quot;optimizer lady&quot;) so she can move onto supporting our new In Memory Database features (note her &lt;b&gt;new&lt;/b&gt;&amp;nbsp;twitter handle for that:&amp;nbsp;&lt;a href=&quot;https://twitter.com/db_inmemory&quot;&gt;https://twitter.com/db_inmemory&lt;/a&gt;&amp;nbsp;).&lt;br /&gt;&lt;br /&gt;To that end, I have two one day Optimizer classes scheduled this year (and more to follow next year!). &amp;nbsp;The first one will be Wednesday November 20th in Northern California. &amp;nbsp;You can find details for that here:&amp;nbsp;&lt;a href=&quot;http://www.nocoug.org/&quot;&gt;http://www.nocoug.org/&lt;/a&gt;&amp;nbsp;.&lt;br /&gt;&lt;br /&gt;The next one will be 5,500 miles (about 8,800 km) away in the UK - in Manchester. &amp;nbsp;That&#39;ll take place immediately following the UKOUG technical conference taking place the first week of December on December 5th. &amp;nbsp;You can see all of the details for that here:&amp;nbsp;&lt;a href=&quot;http://www.ukoug.org/events/tom-kyte-seminar-2013/&quot;&gt;http://www.ukoug.org/events/tom-kyte-seminar-2013/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I know I&#39;ll be doing one in Belgrade early next year, probably the first week in April. Stay tuned for details on that and for more to come.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/4432116633494599094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=4432116633494599094' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4432116633494599094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4432116633494599094'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/11/all-day-optimizer-event.html' title='All day optimizer event....'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-3397106770448613199</id><published>2013-09-16T11:48:00.002-04:00</published><updated>2013-09-16T11:48:51.157-04:00</updated><title type='text'>Checking out Adaptive Execution Plans in 12c</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Just a short note pointing out a new video on how/when adaptive execution plans happen on Oracle Database 12c:&amp;nbsp;&lt;a href=&quot;http://www.youtube.com/watch?v=9o9iuxNBciQ&amp;amp;feature=youtu.be&quot;&gt;http://www.youtube.com/watch?v=9o9iuxNBciQ&amp;amp;feature=youtu.be&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/3397106770448613199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=3397106770448613199' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3397106770448613199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3397106770448613199'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/09/checking-out-adaptive-execution-plans.html' title='Checking out Adaptive Execution Plans in 12c'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-4312667325853846723</id><published>2013-09-15T04:36:00.000-04:00</published><updated>2013-09-15T04:36:18.147-04:00</updated><title type='text'>Oracle OpenWorld 2013, where I&#39;ll be...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I have a fairly busy schedule next week at Oracle OpenWorld 2013.&lt;br /&gt;&lt;br /&gt;It all starts on Sunday with a day long seminar. &amp;nbsp;I&#39;ll be doing a series of &quot;five things about&quot; - in the areas of SQL, PL/SQL, Performance and more. &amp;nbsp;You can check out and register for those sessions (and many others) here:&amp;nbsp;&lt;a href=&quot;http://www.oracle.com/openworld/oracle-university/index.html&quot;&gt;http://www.oracle.com/openworld/oracle-university/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next, on Monday I&#39;ll be delivering:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Session ID: GEN8579&lt;br /&gt; Session Title: General Session: What’s New in Oracle Database Application Development&lt;br /&gt; Venue / Room: Marriott Marquis - Salon 8&lt;br /&gt; Date and Time: 9/23/13, 12:15 - 13:15&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;I&#39;ve done a session like this every year for the last 8 or so years, It&#39;ll cover what new Oracle Database Application development techniques have become available over the last year (and will include a few Oracle Database 12c repeats from last year where relevant). &lt;br /&gt;&lt;br /&gt;Next, on Tuesday I&#39;ll be doing:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Session ID: CON8426&lt;br /&gt; Session Title: The Five Best Things to Happen to SQL&lt;br /&gt; Venue / Room: Moscone South - 103&lt;br /&gt; Date and Time: 9/24/13, 10:30 - 11:30&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;This is not just the five best things to happen to SQL in Oracle Database 12c - but rather - five of the coolest things to happen to the SQL language over the years. &amp;nbsp;You might be surprised at how many you did not know about....&lt;br /&gt;&lt;br /&gt;And lastly - on Wednesday - the last slot before the appreciation event - I&#39;ll be presenting on:&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;i&gt;Session ID: CON11637&lt;br /&gt; Session Title: What’s New in Oracle Database 12c&lt;br /&gt; Venue / Room: Moscone South - 103&lt;br /&gt; Date and Time: 9/25/13, 17:00 - 18:00&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;This is not a repeat of last years &quot;Top 12 Things about Oracle Database 12c&quot;, this is all new content - things discovered and found useful in the last year of using Oracle Database 12c. &amp;nbsp;So, if you have seen my &quot;12 things&quot; talk - or videos - or read the articles in Oracle Magazine, this will be all new and different.&lt;br /&gt;&lt;br /&gt;I hope to see you around - I&#39;ll be on site all week from Saturday evening until Wednesday night (flying back home on a redeye Wednesday). &lt;br /&gt;&lt;br /&gt;Enjoy the show!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/4312667325853846723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=4312667325853846723' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4312667325853846723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4312667325853846723'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/09/oracle-openworld-2013-where-ill-be.html' title='Oracle OpenWorld 2013, where I&#39;ll be...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-5821670008068491554</id><published>2013-07-18T10:12:00.003-04:00</published><updated>2013-07-18T10:12:25.435-04:00</updated><title type='text'>12c - Code Based Access Control (CBAC) part 1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;One frequently asked question posed by stored procedure developers since version 7.0 was released in 1992 has been &quot;&lt;a href=&quot;http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551289900368934430&quot;&gt;why do I get an ora-1031 in PL/SQL but not in SQL*Plus directly&lt;/a&gt;&quot;. &amp;nbsp;I get this question on asktom a lot, I&#39;ve written articles about it in Oracle magazine, I must have explained this thousands of times by now.&lt;br /&gt;&lt;br /&gt;And now, it all has to change - roles and stored procedures are no longer like matter and anti-matter. &amp;nbsp;Staring in Oracle Database 12c a role may be granted to a bit of code, and that role will be active only while that procedure is executing. &amp;nbsp;Think about what that means - you can have a schema chock full of code - hundreds of packages - but have only one package that has a certain privilege at run time. &amp;nbsp;This will allow you to implement the concept of &quot;least privileges&quot; fully. &amp;nbsp;What could be more least privileges than granting a privilege to a specific bit of code?&lt;br /&gt;&lt;br /&gt;Think about this from a SQL injection protection point of view. &amp;nbsp;You could either grant privilege X directly to the schema &amp;nbsp;- meaning this privilege would be available for every single stored unit in that schema to use at anytime, or you can grant this privilege to a role and then grant that role to that unit. &amp;nbsp;That unit and only that unit would be able to use privilege X at runtime. &amp;nbsp;If some other units in that schema had a SQL injection bug - they would not be able to utilize that privilege.&lt;br /&gt;&lt;br /&gt;We&#39;ll take a look at this new capability from two perspectives - from that of a definers rights routine (the default) and from that of an invokers rights routine. &amp;nbsp;In the case of the definers rights routine, this new capability will only make sense when you use dynamic SQL. &amp;nbsp;In the case of the invokers rights routine, this new capability has a much larger impact and makes the use of invokers rights routines much wider than it was in the past. &amp;nbsp;I&#39;ll defer talking more about invokers rights routines until next time and we&#39;ll concentrate on definers rights routines for now.&lt;br /&gt;&lt;br /&gt;Definers rights routines compile with the set of privileges granted directly to the owner of the procedure - roles are &lt;i&gt;never&lt;/i&gt;&amp;nbsp;enabled during the compilation of a compiled stored object. &amp;nbsp;This is true in Oracle Database 12c still - and is the reason this new capability only makes sense with dynamic SQL in a definers rights routine. &amp;nbsp;In order for the unit to compile, all of the privileges necessary for the static SQL and PL/SQL in the unit must be granted directly to the owner of the unit. &amp;nbsp;Therefore - any privileges granted via roles cannot be used for static SQL or PL/SQL. &amp;nbsp;The compilation would fail without the direct privilege. &amp;nbsp;However, any dynamically executed code would not be security checked until runtime, the compiler would not &quot;see&quot; this code. &amp;nbsp;And with CBAC - the set of privileges the dynamic SQL will be checked with will be all of the privileges granted directly to the owner of the unit &lt;i&gt;and&lt;/i&gt;&amp;nbsp;any privileges associated with roles granted to the unit.&lt;br /&gt;&lt;br /&gt;So, if we start with a simple user and role:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; create user a identified by a&lt;br /&gt;  2  default tablespace users&lt;br /&gt;  3  quota unlimited on users;&lt;br /&gt;User created.&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; create role create_table_role;&lt;br /&gt;Role created.&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;and then we grant some privileges to the user and the role:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; grant &lt;span style=&quot;color: red;&quot;&gt;create table&lt;/span&gt; to create_table_role;&lt;br /&gt;Grant succeeded.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; grant &lt;span style=&quot;color: red;&quot;&gt;create session, create procedure&lt;/span&gt; to a;&lt;br /&gt;Grant succeeded.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; grant create_table_role to a with admin option;&lt;br /&gt;Grant succeeded.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; alter user a default role all except create_table_role;&lt;br /&gt;User altered.&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;we are ready to start. Note that the user A has only the create session and create procedure privilege granted to the directly.  They do have the CREATE TABLE privilege, but that privilege is granted via a role to the user - it will not be available to that user during the compilation of a stored unit, nor would it be available at runtime (until we grant it to the code itself).   &lt;br /&gt;&lt;br /&gt;So, let&#39;s create a procedure in this account:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; connect a/a&lt;br /&gt;Connected.&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;a%ORA12CR1&amp;gt; create or replace procedure p&lt;br /&gt;  2  as&lt;br /&gt;  3  begin&lt;br /&gt;  4          execute immediate&lt;br /&gt;  5          &#39;create table t ( x int )&#39;;&lt;br /&gt;  6  end;&lt;br /&gt;  7  /&lt;br /&gt;Procedure created.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, the procedure created successfully since we had the create procedure privilege, but if you try to run it you would receive:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;a%ORA12CR1&amp;gt; exec p&lt;br /&gt;BEGIN p; END;&lt;br /&gt;&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;ORA-01031: insufficient privileges&lt;br /&gt;&lt;/span&gt;ORA-06512: at &quot;A.P&quot;, line 4&lt;br /&gt;ORA-06512: at line 1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and in fact in 11g and before - that would be the&lt;i&gt; only thing &lt;/i&gt;you would ever receive. &amp;nbsp;You would have to grant CREATE TABLE to the schema A - making it available to every single stored unit in that schema. &amp;nbsp;But in Oracle Database 12c - we can grant the CREATE_TABLE_ROLE to the procedure:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;a%ORA12CR1&amp;gt; set role create_table_role;&lt;br /&gt;Role set.&lt;br /&gt;&lt;br /&gt;a%ORA12CR1&amp;gt; &lt;span style=&quot;color: red;&quot;&gt;grant create_table_role to procedure p;&lt;/span&gt;&lt;br /&gt;Grant succeeded.&lt;br /&gt;&lt;br /&gt;a%ORA12CR1&amp;gt;&lt;br /&gt;a%ORA12CR1&amp;gt; exec p&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;a%ORA12CR1&amp;gt; set linesize 40&lt;br /&gt;a%ORA12CR1&amp;gt; desc t&lt;br /&gt; Name              Null?    Type&lt;br /&gt; ----------------- -------- ------------&lt;br /&gt; X                          NUMBER(38)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;the CREATE TABLE privilege is now available to the stored procedure P and only that stored procedure. &amp;nbsp;No other bits of code in this schema would be able to create a table.&lt;br /&gt;&lt;br /&gt;So, in short, dynamic SQL and PL/SQL executed within a definers rights routine can now take advantage of privileges granted to roles. &amp;nbsp;This will allow you to implement the concept of &quot;least privileges&quot; (and to use roles in definers rights routines). &lt;br /&gt;&lt;br /&gt;In the next article, we&#39;ll look at this from the perspective of an invokers rights routine. &amp;nbsp;That is where this new capability gets really interesting!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/5821670008068491554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=5821670008068491554' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/5821670008068491554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/5821670008068491554'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-code-based-access-control-cbac-part.html' title='12c - Code Based Access Control (CBAC) part 1'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-1483259642656077960</id><published>2013-07-17T15:17:00.001-04:00</published><updated>2013-07-18T07:43:05.318-04:00</updated><title type='text'>12c - Whitelists...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Starting in Oracle Database 12c - you can limit down to the package/procedure or function level what bits of code may invoke other bits of code in the database. &amp;nbsp;This process is called &lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/server.121/e17906/chapter1.htm#FEATURENO10047&quot;&gt;&quot;white listing&quot;&lt;/a&gt;&amp;nbsp;and can be used to implement the concept of least privileges in your database.&lt;br /&gt;&lt;br /&gt;In the past - if a given schema A had packages P1, P2, P3, ... Pn - then any of P1 .. Pn could invoke any function or procedure exposed in the specification of any of P1 .. Pn. &amp;nbsp;There would be no way to stop one bit of code from invoking any other bit of code. &amp;nbsp;This could have implications in the area of SQL Injection. &amp;nbsp;If one of the packages was subject to a SQL Injection bug - then that package could be used to execute &lt;i&gt;ANY&lt;/i&gt;&amp;nbsp;of the existing bits of code in that schema. &amp;nbsp;Additionally - even if none of the packages in that schema had a SQL Injection bug - but the application connected to the database itself did, an attacker could use that bug to execute any bit of code in that schema.&lt;br /&gt;&lt;br /&gt;With the white list approach, the only way to execute a given piece of code would be to run it from a specific set of compiled units. &amp;nbsp;You cannot execute a white listed unit from the top level, it must be called by some specific set of units. &amp;nbsp;Now a SQL injection bug in the application cannot execute this code (it would have to call it as a top level call - but a white listed unit cannot be called that way). &amp;nbsp;And even further - a SQL injection bug in the code stored in the database will not be able to execute this white listed code (unless of course it was on the white list).&lt;br /&gt;&lt;br /&gt;This is all accomplished with the new &quot;accessible by&quot; clause. &amp;nbsp;The use of this clause on a unit will restrict the calling set of units to be those in the accessible by clause and the unit itself (a units code is always accessible to itself).&lt;br /&gt;&lt;br /&gt;For example, I&#39;ll create a package that is to be used only by procedure P1 (and itself) in some schema:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace package my_pkg&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;  2  accessible by (p1)&lt;br /&gt;&lt;/span&gt;  3  as&lt;br /&gt;  4      procedure p;&lt;br /&gt;  5      function f return number;&lt;br /&gt;  6  end;&lt;br /&gt;  7  /&lt;br /&gt;Package created.&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace package body my_pkg&lt;br /&gt;  2  as&lt;br /&gt;  3&lt;br /&gt;  4  procedure p&lt;br /&gt;  5  is&lt;br /&gt;  6  begin&lt;br /&gt;  7      dbms_output.put_line( &#39;hello world&#39; );&lt;br /&gt;  8  end;&lt;br /&gt;  9&lt;br /&gt; 10  function f return number&lt;br /&gt; 11  is&lt;br /&gt; 12  begin&lt;br /&gt; 13          p;&lt;br /&gt; 14          return 42;&lt;br /&gt; 15  end;&lt;br /&gt; 16&lt;br /&gt; 17  end;&lt;br /&gt; 18  /&lt;br /&gt;Package body created.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;as you can see - I&#39;ve used the accessible by clause in the package specification. &amp;nbsp;This will restrict this package to be invoked &lt;i&gt;only by &lt;/i&gt;procedure P1 or the package MY_PKG in this same schema. We can see that MY_PKG can invoke itself since function F calls procedure P in that same package. &amp;nbsp;Additionally - we can see that only procedure P1 outside of MY_PKG can invoke the functionality of this package. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace procedure p1&lt;br /&gt;  2  as&lt;br /&gt;  3  begin&lt;br /&gt;  4      my_pkg.p;&lt;br /&gt;  5  end;&lt;br /&gt;  6  /&lt;br /&gt;&lt;br /&gt;Procedure created.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace procedure p2&lt;br /&gt;  2  as&lt;br /&gt;  3  begin&lt;br /&gt;  4      my_pkg.p;&lt;br /&gt;  5  end;&lt;br /&gt;  6  /&lt;br /&gt;&lt;br /&gt;Warning: Procedure created with compilation errors.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; show errors&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;Errors for PROCEDURE P2:&lt;br /&gt;&lt;br /&gt;LINE/COL ERROR&lt;br /&gt;-------- -----------------------------------------------------------------&lt;br /&gt;4/5      PL/SQL: Statement ignored&lt;br /&gt;4/5      PLS-00904: insufficient privilege to access object MY_PKG&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Procedure P1 successfully compiles and would be able to invoke MY_PKG.P but P2 cannot. &amp;nbsp;Furthermore, an attempt to execute MY_PKG as a top level call will fail:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; exec my_pkg.p&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;BEGIN my_pkg.p; END;&lt;br /&gt;&lt;br /&gt;      *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-06550: line 1, column 7:&lt;br /&gt;PLS-00904: insufficient privilege to access object MY_PKG&lt;br /&gt;ORA-06550: line 1, column 7:&lt;br /&gt;PL/SQL: Statement ignored&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;It should be noted that the acccessible by clause list is not evaluated at compile time for the unit being protected. &amp;nbsp;In the above example - we stated MY_PKG would be accessible by P1, before P1 was created. &amp;nbsp;That means you can put just about anything you want in the accessible by clause without raising an error (so be careful). &lt;br /&gt;&lt;br /&gt;The accessible clause can be used across schemas as well. &amp;nbsp;If we recreate the package specification as:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace package my_pkg&lt;br /&gt;  2  accessible by (p1,&lt;span style=&quot;color: red;&quot;&gt;scott.p&lt;/span&gt;)&lt;br /&gt;  3  as&lt;br /&gt;  4      procedure p;&lt;br /&gt;  5      function f return number;&lt;br /&gt;  6  end;&lt;br /&gt;  7  /&lt;br /&gt;&lt;br /&gt;Package created.&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; grant execute on my_pkg to scott;&lt;br /&gt;Grant succeeded.&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;we&#39;ll be able to successfully compile and execute the code from SCOTT.P:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; connect scott/tiger&lt;br /&gt;Connected.&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;scott%ORA12CR1&amp;gt; create or replace procedure p&lt;br /&gt;  2  as&lt;br /&gt;  3  begin&lt;br /&gt;  4          ops$tkyte.my_pkg.p;&lt;br /&gt;  5  end;&lt;br /&gt;  6  /&lt;br /&gt;Procedure created.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;scott%ORA12CR1&amp;gt; exec p&lt;br /&gt;hello world&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;scott%ORA12CR1&amp;gt; exec ops$tkyte.my_pkg.p&lt;br /&gt;BEGIN ops$tkyte.my_pkg.p; END;&lt;br /&gt;&lt;br /&gt;      *&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;ERROR at line 1:&lt;br /&gt;ORA-06550: line 1, column 7:&lt;br /&gt;PLS-00904: insufficient privilege to access object MY_PKG&lt;br /&gt;ORA-06550: line 1, column 7:&lt;br /&gt;PL/SQL: Statement ignored&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;but note that once again - SCOTT cannot invoke this package from the top level either - meaning if the SCOTT schema has some SQL injection issues - we&#39;ve removed the ability for an attacker to invoke OPS$TKYTE.MY_PKG from that schema.&lt;br /&gt;&lt;br /&gt;Next time I&#39;ll be taking a look at another new PL/SQL security feature - code based access control, the ability to grant ROLES to code...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/1483259642656077960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=1483259642656077960' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/1483259642656077960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/1483259642656077960'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-whitelists.html' title='12c - Whitelists...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-8568982907315286192</id><published>2013-07-11T04:56:00.000-04:00</published><updated>2013-07-11T04:56:37.099-04:00</updated><title type='text'>12c - Implicit Result Sets...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Since version 7.2 of Oracle we&#39;ve been able to return result sets from stored procedures to clients. &amp;nbsp;The way we&#39;ve accomplished this in the past is &lt;a href=&quot;http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551171813078805685&quot;&gt;via a REF CURSOR&lt;/a&gt;. &amp;nbsp;I&#39;ve always liked this approach since it makes it so that the signature of a stored procedure/function makes it clear that a procedure/function a) actually returns a result set and b) can be done such that the &#39;shape&#39; of the result set is known at compile time.&lt;br /&gt;&lt;br /&gt;What that means is - the REF CURSOR would be a formal named parameter for the procedure or the return value of a function. &amp;nbsp;If you describe the procedure - you&#39;ll see it. &amp;nbsp;You&#39;ll know exactly how many result sets the procedure returns and you have the capability to know the number of columns, names of columns and datatypes if the developer chose to use strongly typed ref cursors. &amp;nbsp;In other words - you&#39;ll know what you are getting, the REF CURSORS are explicitly there, staring you in the face.&lt;br /&gt;&lt;br /&gt;Other databases adopted an implicit approach. &amp;nbsp;If you describe their procedures - you will have no idea how many or what kind of result sets they return. &amp;nbsp;You have to run them and see what they decide to send back - and each time you run them, they could return a different result. &amp;nbsp;In other words, you had to read the code to see what results might be coming back to you. &amp;nbsp;I&#39;m not a huge fan of this approach - it is much less self documenting, more error prone (in my opinion).&lt;br /&gt;&lt;br /&gt;That said - this difference (explicit versus implicit result sets) can make migrating an application from these databases to Oracle difficult. &amp;nbsp;You have to change the inputs/outputs of your stored procedures - adding the ref cursors and &lt;i&gt;you have to modify the client code.&lt;/i&gt;&amp;nbsp; You cannot just change the stored procedure, you have to change the client. &amp;nbsp;When using implicit result sets - the client code would look similar to this psuedo code:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;execute stored procedure( param1, param2, .. paramN )&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;while more result-sets loop&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;while more-data-from-that-result-set loop&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;process data&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;end while more-data-from-that-result-set&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;end while result-sets&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;while the code for explict result sets would resemble:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;execute stored procedure&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;( param1, param2, ... paramN,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; result-set1, result-set2, ... result-setN)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;while more-data-in-result-set1 loop&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; process data&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;end while more-data-in-result-set1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;while more-data-in-result-setN loop&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; process data&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;end while more-data-in-result-setN&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;so, the structure of the client code must be modified in addition to the stored procedures signature (it&#39;s inputs and outputs). &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In order to ease migrations from implicit result set databases to Oracle, Oracle database 12c introduced support for implicit result sets - result sets that can be returned to a client but do not necessitate a formal named parameter. &amp;nbsp;The client code to process such a result set is identical now - the client code needs not change, the stored procedure signature need not change - the body of the procedure just needs to be implemented in PL/SQL.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;We accomplish this magic in PL/SQL via two new API calls in the DBMS_SQL package - one for returning REF CURSORS and one for returning DBMS_SQL cursors. &amp;nbsp;They are:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;PROCEDURE RETURN_RESULT(rc IN OUT SYS_REFCURSOR, to_client IN BOOLEAN DEFAULT TRUE); &lt;br /&gt;PROCEDURE RETURN_RESULT(rc IN OUT INTEGER, to_client IN BOOLEAN DEFAULT TRUE);&lt;br /&gt;&lt;br /&gt;TO_CLIENT =&amp;gt; true, return to client layer&lt;br /&gt;TO_CLIENT=&amp;gt; false, return to invoker, immediate caller - could be another plsql routine&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;to demonstrate this, we can use SQL*Plus as the client and show an implicit result set being returned to the client and auto-magically printed (this will only work with a 12c SQL*Plus!! it is the first SQL*Plus to recognize that there might be result sets to print)&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; declare&lt;br /&gt;  2      c1 sys_refcursor;&lt;br /&gt;  3      c2 sys_refcursor;&lt;br /&gt;  4  begin&lt;br /&gt;  5      open c1 for select * from dept;&lt;br /&gt;  6      dbms_sql.return_result(c1);&lt;br /&gt;  7&lt;br /&gt;  8      open c2 for select * from dual;&lt;br /&gt;  9      dbms_sql.return_result(c2);&lt;br /&gt; 10  end;&lt;br /&gt; 11  /&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;ResultSet #1&lt;br /&gt;&lt;br /&gt;    DEPTNO DNAME          LOC&lt;br /&gt;---------- -------------- -------------&lt;br /&gt;        10 ACCOUNTING     NEW YORK&lt;br /&gt;        20 RESEARCH       DALLAS&lt;br /&gt;        30 SALES          CHICAGO&lt;br /&gt;        40 OPERATIONS     BOSTON&lt;br /&gt;&lt;br /&gt;ResultSet #2&lt;br /&gt;&lt;br /&gt;D&lt;br /&gt;-&lt;br /&gt;X&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;as you can see - there were no inputs/outputs to this block of code - we implicitlly returned the two result sets using the new DBMS_SQL API and SQL*Plus used a method that would result the second set of psuedo code above to discover what results might be available and then print them out.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can process these implicit result sets in PL/SQL if we want (they don&#39;t have to be returned to a client - the ref cursor/dbms_sql cursor can be implicitly returned to a PL/SQL function/procedure) using the two new API calls:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;PROCEDURE GET_NEXT_RESULT(c IN INTEGER, rc OUT SYS_REFCURSOR);&lt;br /&gt;PROCEDURE GET_NEXT_RESULT(c IN INTEGER, rc OUT INTEGER);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;(see&amp;nbsp;&lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/appdev.121/e17622/dynamic.htm#LNPLS2176&quot;&gt;http://docs.oracle.com/cd/E16655_01/appdev.121/e17622/dynamic.htm#LNPLS2176&lt;/a&gt;&amp;nbsp;for a description and example of this API).&lt;br /&gt;&lt;br /&gt;But in general, it&#39;ll be a client bit of code that processes these result sets and a client java program might resemble:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Connection conn = DriverManager.getConnection(jdbcURL, user, password);&lt;br /&gt;try &lt;br /&gt;{&lt;br /&gt;    Statement stmt = conn.createStatement (); &lt;br /&gt;    stmt.executeQuery ( “begin foo; end;” );&lt;br /&gt; &lt;br /&gt;    while (stmt.getMoreResults())&lt;br /&gt;    {&lt;br /&gt;         ResultSet rs = stmt.getResultSet();&lt;br /&gt;         System.out.println(&quot;ResultSet&quot;);&lt;br /&gt;         while (rs.next())&lt;br /&gt;         {   &lt;br /&gt;               /* get results */&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I see Tim Hall has written about this recently as well - you can see his writeup here:&amp;nbsp;&lt;a href=&quot;http://www.oracle-base.com/articles/12c/implicit-statement-results-12cr1.php&quot;&gt;http://www.oracle-base.com/articles/12c/implicit-statement-results-12cr1.php&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/8568982907315286192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=8568982907315286192' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8568982907315286192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8568982907315286192'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-implicit-result-sets.html' title='12c - Implicit Result Sets...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-2760922721765117939</id><published>2013-07-08T10:42:00.000-04:00</published><updated>2013-07-08T10:46:11.672-04:00</updated><title type='text'>12c - SQL Plus new things....</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;SQL Plus is still my typical tool of choice to &quot;talk&quot; to Oracle - 25+ years and going... &amp;nbsp;Oracle Database 12c has introduced a few new things in this venerable old tool&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Last Login Time&lt;/h3&gt;&lt;pre&gt;$ sqlplus /&lt;br /&gt;&lt;br /&gt;SQL*Plus: Release 12.1.0.1.0 Production on Sun Jul 7 13:53:15 2013&lt;br /&gt;&lt;br /&gt;Copyright (c) 1982, 2013, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;Last Successful login time: Wed Jul 03 2013 14:30:14 -04:00&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Connected to:&lt;br /&gt;Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production&lt;br /&gt;With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;By default, SQL Plus will display your last login time - if you don&#39;t want that, just use -nologintime.&lt;br /&gt;&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;More on invisible columns&lt;/h3&gt;I &lt;a href=&quot;http://tkyte.blogspot.co.il/2013/07/12c-invisible-columns.html&quot;&gt;recently wrote about invisible columns&lt;/a&gt; and how they wouldn&#39;t be displayed via a DESCRIBE command. &amp;nbsp;That is - SQL Plus won&#39;t show them &lt;b&gt;by default&lt;/b&gt;. &amp;nbsp;However, there is a SET command that will display them:&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create table t&lt;br /&gt;  2  ( x int,&lt;br /&gt;  3    y int &lt;span style=&quot;color: red;&quot;&gt;invisible&lt;/span&gt;&lt;br /&gt;  4  );&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; desc t&lt;br /&gt; Name                                     Null?    Type&lt;br /&gt; ---------------------------------------- -------- ----------------------------&lt;br /&gt; X                                                 NUMBER(38)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; show colinvisible&lt;br /&gt;colinvisible OFF&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; set colinvisible ON&lt;br /&gt;&lt;/span&gt;ops$tkyte%ORA12CR1&amp;gt; desc t&lt;br /&gt; Name                                     Null?    Type&lt;br /&gt; ---------------------------------------- -------- ----------------------------&lt;br /&gt; X                                                 NUMBER(38)&lt;br /&gt; &lt;span style=&quot;color: red;&quot;&gt;Y (INVISIBLE)                                     NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Support for Pluggable Databases&lt;/h3&gt;There is support for starting pluggable databases from a container database, as well as three new SHOW commands to see what pluggable databases there are and information about the current pluggable database you are connected to:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;sys%ORCL&amp;gt; &lt;span style=&quot;color: red;&quot;&gt;startup pluggable database pdborcl;&lt;/span&gt;&lt;br /&gt;Pluggable Database opened.&lt;br /&gt;&lt;br /&gt;sys%ORCL&amp;gt; show pdbs&lt;br /&gt;&lt;br /&gt;    CON_ID CON_NAME                       OPEN MODE  RESTRICTED&lt;br /&gt;---------- ------------------------------ ---------- ----------&lt;br /&gt;         2 PDB$SEED                       READ ONLY  NO&lt;br /&gt;         3 PDBORCL                        READ WRITE NO&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sys%ORCL&amp;gt; connect scott/tiger@pdborcl&lt;br /&gt;Connected.&lt;br /&gt;&lt;br /&gt;scott%PDBORCL&amp;gt; &lt;span style=&quot;color: red;&quot;&gt;show con_id&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;CON_ID&lt;br /&gt;------------------------------&lt;br /&gt;3&lt;br /&gt;&lt;br /&gt;scott%PDBORCL&amp;gt; &lt;span style=&quot;color: red;&quot;&gt;show con_name&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;CON_NAME&lt;br /&gt;------------------------------&lt;br /&gt;PDBORCL&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;For more details...&lt;/h3&gt;&lt;br /&gt;For more details - check out the &lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/server.121/e18404/toc.htm&quot;&gt;SQL Plus guide&lt;/a&gt;. &amp;nbsp;It is always good to look through the existing commands anyway - to remind you of something you forgot you already knew (I do that all a lot - forget things I knew once upon &amp;nbsp;a time. &amp;nbsp;Just looking at the table of contents for SQL Plus could remind you of many forgotten SHOW and SET commands!)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/2760922721765117939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=2760922721765117939' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/2760922721765117939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/2760922721765117939'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-sql-plus-new-things.html' title='12c - SQL Plus new things....'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-8665699764701779447</id><published>2013-07-05T11:23:00.001-04:00</published><updated>2013-07-05T11:23:45.622-04:00</updated><title type='text'>In Israel...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I&#39;m in Israel now getting ready for the&amp;nbsp;&lt;a href=&quot;http://www.iloug.org.il/home.php&quot;&gt;http://www.iloug.org.il/&lt;/a&gt;&amp;nbsp;conference in Jerusalem next week. &amp;nbsp;Looks to be a good one with Mark Rittman, Joel Kallman and many others speaking!&lt;br /&gt;&lt;br /&gt;See&amp;nbsp;&lt;a href=&quot;http://www.iloug.org.il/TechDays/?page=BigData_BI#track&quot;&gt;http://www.iloug.org.il/TechDays/?page=BigData_BI#track&lt;/a&gt;&amp;nbsp; for the agenda...&lt;br /&gt;&lt;br /&gt;The weather is beyond phenomenal here - see&amp;nbsp;&lt;a href=&quot;https://twitter.com/OracleAskTom/status/353171810784772098&quot;&gt;https://twitter.com/OracleAskTom/status/353171810784772098&lt;/a&gt;&amp;nbsp; for a quick picture.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/8665699764701779447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=8665699764701779447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8665699764701779447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8665699764701779447'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/in-israel.html' title='In Israel...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-4147120076767939731</id><published>2013-07-05T11:15:00.000-04:00</published><updated>2013-07-05T11:15:24.218-04:00</updated><title type='text'>12c - Multiple same column indexes...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Another new capability of Oracle Database 12c is the ability to create more than one index on the same set of attributes. &amp;nbsp;That is - you can have two or more indexes on the column &quot;X&quot;, or the set of columns &quot;A,B,C&quot;.&lt;br /&gt;&lt;br /&gt;So, that would beg the question &quot;why - why would you want to do that?&quot;. &amp;nbsp;The answer is twofold - testing and availability. &amp;nbsp;The testing part is obvious - you might want to test how the performance of a bitmap index would be in your reporting system as compared to a b*tree index on the same set of columns. &amp;nbsp;You can now create that bitmap index even though the b*tree exists, test it out in your session, and then decide to get rid of the b*tree index in favor of the bitmap (or get rid of the bitmap of course).&lt;br /&gt;&lt;br /&gt;The availability part isn&#39;t as obvious perhaps. &amp;nbsp;If you wanted to roll out a change to production that would replace a normal b*tree index with a reverse key index - that would have called for an outage in the past. &amp;nbsp;You would have to drop the original index and then create the new one. &amp;nbsp;During the period of time the index was initially dropped and the new one completed work, it is likely the applications that depended on that index for data retrieval would have to be offlined. &amp;nbsp;If they were not - their performance, in light of the missing index, could be disastrous - in effect, a denial of service attack on the database.&lt;br /&gt;&lt;br /&gt;In Oracle Database 11g and before - this is what we would expect if we attempted to create more than one index on the same set of attributes:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA11GR2&amp;gt; create table t ( x int, y int, z int );&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA11GR2&amp;gt; create index t_idx on t(x,y);&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA11GR2&amp;gt; create bitmap index t_idx2 on t(x,y);&lt;br /&gt;create bitmap index t_idx2 on t(x,y)&lt;br /&gt;                                *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-01408: such column list already indexed&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA11GR2&amp;gt; create bitmap index t_idx2 on t(x,y) invisible;&lt;br /&gt;create bitmap index t_idx2 on t(x,y) invisible&lt;br /&gt;                                *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-01408: such column list already indexed&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;as you can see - it just wasn&#39;t going to happen. &amp;nbsp;But now in 12c - as long as only one index is &quot;visible&quot; - we can create multiple indexes:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; create table t ( x int, y int, z int );&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; create index t_idx on t(x,y);&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; create bitmap index t_idx2 on t(x,y) invisible;&lt;br /&gt;Index created.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now that the second index is there, we can test it - to evaluate the performance for example - easily:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ops$tkyte%ORA12CR1&amp;gt; alter session set optimizer_use_invisible_indexes=true;&lt;br /&gt;&lt;br /&gt;Session altered.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; exec dbms_stats.set_table_stats( user, &#39;T&#39;, numrows =&amp;gt; 1000000, numblks =&amp;gt; 100000 );&lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; set autotrace traceonly explain&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; select count(*) from t;&lt;br /&gt;&lt;br /&gt;Execution Plan&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Plan hash value: 1106681275&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;| Id  | Operation                     | Name   | Rows  | Cost (%CPU)|&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;|   0 | SELECT STATEMENT              |        |     1 |     0   (0)|&lt;br /&gt;|   1 |  SORT AGGREGATE               |        |     1 |            |&lt;br /&gt;|   2 |   BITMAP CONVERSION COUNT     |        |  1000K|            |&lt;br /&gt;|   3 |    BITMAP INDEX FAST FULL SCAN| T_IDX2 |       |            |&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;ops$tkyte%ORA12CR1&amp;gt; set autotrace off&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;if we deemed that index to be what we really wanted - we would just drop the old index and make this one visible, or set the old one invisible and set this one visible - publish it in effect.&lt;br /&gt;&lt;br /&gt;See&amp;nbsp;&lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/server.121/e17906/chapter1.htm#FEATURENO09740&quot;&gt;http://docs.oracle.com/cd/E16655_01/server.121/e17906/chapter1.htm#FEATURENO09740&lt;/a&gt;&amp;nbsp;and especially&amp;nbsp;&lt;a href=&quot;http://richardfoote.wordpress.com/2013/07/02/12c-intro-to-multiple-indexes-on-same-column-list-repetition/&quot;&gt;http://richardfoote.wordpress.com/2013/07/02/12c-intro-to-multiple-indexes-on-same-column-list-repetition/&lt;/a&gt;&amp;nbsp;for more info. &amp;nbsp;(and subscribe to Richard&#39;s blog if you aren&#39;t already - best index information out there)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/4147120076767939731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=4147120076767939731' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4147120076767939731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4147120076767939731'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-multiple-same-column-indexes.html' title='12c - Multiple same column indexes...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-7023346512715840821</id><published>2013-07-03T07:04:00.001-04:00</published><updated>2013-07-04T04:35:54.284-04:00</updated><title type='text'>12c - flashforward, flashback or see it as of now...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Oracle 9i exposed flashback query to developers for the first time. &amp;nbsp;The ability to flashback query dates back to version 4 however (it just wasn&#39;t exposed). &amp;nbsp;Every time you run a query in Oracle it is in fact a flashback query - it is what multi-versioning is all about.&lt;br /&gt;&lt;br /&gt;However, there was never a flashforward query (well, ok, the workspace manager has this capability - but with lots of extra baggage). &amp;nbsp;We&#39;ve never been able to ask a table &quot;what will you look like tomorrow&quot; - but now we do.&lt;br /&gt;&lt;br /&gt;The capability is called &lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/server.121/e17613/part_lifecycle.htm#VLDBG14127&quot;&gt;Temporal Validity&lt;/a&gt;. &amp;nbsp;If you have a table with data that is effective dated - has a &quot;start date&quot; and &quot;end date&quot; column in it - we can now query it using flashback query like syntax. &amp;nbsp;The twist is - the date we &quot;flashback&quot; to can be in the future. &amp;nbsp;It works by rewriting the query to transparently the necessary where clause and filter out the right rows for the right period of time - and since you can have records whose start date is in the future - you can query a table and see what it would look like at some future time.&lt;br /&gt;&lt;br /&gt;Here is a quick example, we&#39;ll start with a table:&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create table addresses&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;( empno &amp;nbsp; &amp;nbsp; &amp;nbsp; number,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp;addr_data &amp;nbsp; varchar2(30),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp;start_date &amp;nbsp;date,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp;end_date &amp;nbsp; &amp;nbsp;date,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp;period for valid(start_date,end_date)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 7 &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 8 &amp;nbsp;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table created.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;the new bit is on line 6 (it can be altered into an existing table - so any table &amp;nbsp;you have with a start/end date column will be a candidate). &amp;nbsp;The keyword is PERIOD, valid is an identifier I chose - it could have been foobar, valid just sounds nice in the query later. &amp;nbsp;You identify the columns in your table - or we can create them for you if they don&#39;t exist. &amp;nbsp;Then you just create some data:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; insert into addresses (empno, addr_data, start_date, end_date )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;values ( 1234, &#39;123 Main Street&#39;, trunc(sysdate-5), trunc(sysdate-2) );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;1 row created.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; insert into addresses (empno, addr_data, start_date, end_date )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;values ( 1234, &#39;456 Fleet Street&#39;, trunc(sysdate-1), trunc(sysdate+1) );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;1 row created.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; insert into addresses (empno, addr_data, start_date, end_date )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;values ( 1234, &#39;789 1st Ave&#39;, trunc(sysdate+2), null );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;1 row created.&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&gt;and you can either see all of the data:&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from addresses;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;EMPNO ADDR_DATA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;START_DAT END_DATE&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;---------- ------------------------------ --------- ---------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234 123 Main Street &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27-JUN-13 30-JUN-13&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234 456 Fleet Street &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-JUL-13 03-JUL-13&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234 789 1st Ave &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;04-JUL-13&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;or query &quot;as of&quot; some point in time - as &amp;nbsp;you can see in the predicate section - it is just doing a query rewrite to automate the &quot;where&quot; filters:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from addresses as of period for valid sysdate-3;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;EMPNO ADDR_DATA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;START_DAT END_DATE&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;---------- ------------------------------ --------- ---------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234 123 Main Street &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27-JUN-13 30-JUN-13&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; @plan&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from table(dbms_xplan.display_cursor);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;PLAN_TABLE_OUTPUT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;SQL_ID &amp;nbsp;cthtvvm0dxvva, child number 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;select * from addresses as of period for valid sysdate-3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Plan hash value: 3184888728&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Name &amp;nbsp; &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)| Time &amp;nbsp; &amp;nbsp; |&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;| &amp;nbsp; 0 | SELECT STATEMENT &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; 3 (100)| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;|* &amp;nbsp;1 | &amp;nbsp;TABLE ACCESS FULL| ADDRESSES | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;48 | &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; (0)| 00:00:01 |&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Predicate Information (identified by operation id):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;---------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;1 - filter(((&quot;T&quot;.&quot;START_DATE&quot; IS NULL OR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;T&quot;.&quot;START_DATE&quot;&amp;lt;=SYSDATE@!-3) AND (&quot;T&quot;.&quot;END_DATE&quot; IS NULL OR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;T&quot;.&quot;END_DATE&quot;&amp;gt;SYSDATE@!-3)))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Note&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-----&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;- dynamic statistics used: dynamic sampling (level=2)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;24 rows selected.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from addresses as of period for valid sysdate;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;EMPNO ADDR_DATA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;START_DAT END_DATE&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;---------- ------------------------------ --------- ---------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234 456 Fleet Street &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-JUL-13 03-JUL-13&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; @plan&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from table(dbms_xplan.display_cursor);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;PLAN_TABLE_OUTPUT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;SQL_ID &amp;nbsp;26ubyhw9hgk7z, child number 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;select * from addresses as of period for valid sysdate&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Plan hash value: 3184888728&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Name &amp;nbsp; &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)| Time &amp;nbsp; &amp;nbsp; |&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;| &amp;nbsp; 0 | SELECT STATEMENT &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; 3 (100)| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;|* &amp;nbsp;1 | &amp;nbsp;TABLE ACCESS FULL| ADDRESSES | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;48 | &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; (0)| 00:00:01 |&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Predicate Information (identified by operation id):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;---------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;1 - filter(((&quot;T&quot;.&quot;START_DATE&quot; IS NULL OR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;T&quot;.&quot;START_DATE&quot;&amp;lt;=SYSDATE@!) AND (&quot;T&quot;.&quot;END_DATE&quot; IS NULL OR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;T&quot;.&quot;END_DATE&quot;&amp;gt;SYSDATE@!)))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Note&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-----&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;- dynamic statistics used: dynamic sampling (level=2)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;24 rows selected.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from addresses as of period for valid sysdate+3;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;EMPNO ADDR_DATA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;START_DAT END_DATE&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;---------- ------------------------------ --------- ---------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234 789 1st Ave &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;04-JUL-13&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; @plan&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from table(dbms_xplan.display_cursor);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;PLAN_TABLE_OUTPUT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;SQL_ID &amp;nbsp;36bq7shnhc888, child number 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;select * from addresses as of period for valid sysdate+3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Plan hash value: 3184888728&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;| Id &amp;nbsp;| Operation &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Name &amp;nbsp; &amp;nbsp; &amp;nbsp;| Rows &amp;nbsp;| Bytes | Cost (%CPU)| Time &amp;nbsp; &amp;nbsp; |&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;| &amp;nbsp; 0 | SELECT STATEMENT &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; 3 (100)| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;|* &amp;nbsp;1 | &amp;nbsp;TABLE ACCESS FULL| ADDRESSES | &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp;48 | &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; (0)| 00:00:01 |&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Predicate Information (identified by operation id):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;---------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;1 - filter(((&quot;T&quot;.&quot;START_DATE&quot; IS NULL OR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;T&quot;.&quot;START_DATE&quot;&amp;lt;=SYSDATE@!+3) AND (&quot;T&quot;.&quot;END_DATE&quot; IS NULL OR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;T&quot;.&quot;END_DATE&quot;&amp;gt;SYSDATE@!+3)))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Note&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;-----&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;- dynamic statistics used: dynamic sampling (level=2)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;24 rows selected.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;All in all a nice, easy way to query effective dated information as of a point in time without a complex where clause. &amp;nbsp;You need to maintain the data - it isn&#39;t that a delete will turn into an update the end dates a record or anything - but if you have tables with start/end dates, this will make it much easier to query them.&lt;br /&gt;&lt;br /&gt;*Note added 4-jul-2013: this feature currently is not supported/working with the pluggable database infrastructure. &amp;nbsp;This is a temporary limitation.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/7023346512715840821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=7023346512715840821' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/7023346512715840821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/7023346512715840821'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-flashforward-flashback-or-see-it-as.html' title='12c - flashforward, flashback or see it as of now...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-3930584867487188434</id><published>2013-07-02T14:03:00.004-04:00</published><updated>2013-07-02T14:03:37.642-04:00</updated><title type='text'>12c - Silly little trick with invisibility...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;This is interesting, if you hide and then unhide a column - it will end up at the &quot;end&quot; of the table. &amp;nbsp;Consider:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create table t ( a int, b int, c int );&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table created.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; desc t;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;Name &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;Null? &amp;nbsp; &amp;nbsp;Type&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;----------------------------------------------------- -------- ------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&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; &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;B &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;C &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t modify (a invisible);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table altered.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t modify (a visible);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table altered.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; desc t;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;Name &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;Null? &amp;nbsp; &amp;nbsp;Type&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;----------------------------------------------------- -------- ------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;B &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;C &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&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; &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, that means you can add a column or shuffle them around. &amp;nbsp;What if we had just added A to the table and really really wanted A to be first. &amp;nbsp;My first approach would be &quot;that is what editioning views are great at&quot;. &amp;nbsp;If I couldn&#39;t use an editioning view for whatever reason - we could shuffle the columns:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t modify (b invisible);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table altered.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t modify (c invisible);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table altered.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t modify (b visible);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table altered.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t modify (c visible);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table altered.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; desc t;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;Name &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;Null? &amp;nbsp; &amp;nbsp;Type&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;----------------------------------------------------- -------- ------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&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; &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;B &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;C &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;NUMBER(38)&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note: that could cause some serious invalidations in your database - so make sure you are a) aware of that b) willing to pay that penalty and c) really really really want A to be first in the table!&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/3930584867487188434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=3930584867487188434' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3930584867487188434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3930584867487188434'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-silly-little-trick-with-invisibility.html' title='12c - Silly little trick with invisibility...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-6372565500854347786</id><published>2013-07-02T10:50:00.000-04:00</published><updated>2013-07-02T10:50:59.751-04:00</updated><title type='text'>12c - Invisible Columns...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Remember when 11g first came out and we had &quot;invisible indexes&quot;? &amp;nbsp;It seemed like a confusing feature - indexes that would be maintained by modifications (hence slowing them down), but would not be used by queries (hence never speeding them up). &amp;nbsp;But - after you looked at them a while, you could see how they can be useful. &amp;nbsp;For example - to add an index in a running production system, an index used by the next version of the code to be introduced later that week - but not tested against the queries in version one of the application in place now. &amp;nbsp;We all know that when you add an index - one of three things can happen - a given query will go much faster, it won&#39;t affect a given query at all, or... It will make some untested query go much much slower than it used to. &amp;nbsp;So - invisible indexes allowed us to modify the schema in a &#39;safe&#39; manner - hiding the change until we were ready for it.&lt;br /&gt;&lt;br /&gt;Invisible columns accomplish the same thing - the ability to introduce a change while minimizing any negative side effects of that change. &amp;nbsp;Normally when you add a column to a table - any program with a SELECT * would start seeing that column, and programs with an INSERT INTO T VALUES (...) would pretty much immediately break (an INSERT without a list of columns in it). &amp;nbsp;Now we can add a column to a table in an invisible fashion, the column will not show up in a DESCRIBE command in SQL*Plus, it will not be returned with a SELECT *, it will not be considered in an INSERT INTO T VALUES statement. &amp;nbsp;It can be accessed by any query that asks for it, it can be populated by an INSERT statement that references it, but you won&#39;t see it otherwise.&lt;br /&gt;&lt;br /&gt;For example, let&#39;s start with a simple two column table:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create table t&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;( x int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp;y int&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table created.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; insert into t values ( 1, 2 );&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;1 row created.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, we will add an invisible column to it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t add&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ( z int &lt;span style=&quot;color: red;&quot;&gt;INVISIBLE &lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table altered.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Notice that a DESCRIBE will not show us this column:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; desc t&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;Name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Null? &amp;nbsp; &amp;nbsp;Type&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;----------------- -------- ------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;X &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;NUMBER(38)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;Y &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;NUMBER(38)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and existing inserts are unaffected by it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; insert into t values ( 3, 4 );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;1 row created.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;A SELECT * won&#39;t see it either:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from t;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;---------- ----------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But we have full access to it (in well written programs! The ones that use a column list in the insert and select - never relying on &quot;defaults&quot;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; insert into t &lt;span style=&quot;color: red;&quot;&gt;(x,y,z)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&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; values ( 5,6,7 );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;1 row created.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select &lt;span style=&quot;color: red;&quot;&gt;x, y, z&lt;/span&gt; from t;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;---------- ---------- ----------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and when we are sure that we are ready to go with this column, we can just modify it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; alter table t modify z &lt;span style=&quot;color: red;&quot;&gt;visible&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table altered.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; select * from t;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;---------- ---------- ----------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&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&gt;I will say that a better approach to this - one that is available in 11gR2 and above - would be to use editioning views (part of Edition Based Redefinition - EBR ). &amp;nbsp;I would rather use EBR over this approach, but in an environment where EBR is not being used, or the editioning views are not in place, this will achieve much the same.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Read these for information on EBR:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://www.oracle.com/technetwork/issue-archive/2010/10-jan/o10asktom-172777.html&quot;&gt;http://www.oracle.com/technetwork/issue-archive/2010/10-jan/o10asktom-172777.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://www.oracle.com/technetwork/issue-archive/2010/10-mar/o20asktom-098897.html&quot;&gt;http://www.oracle.com/technetwork/issue-archive/2010/10-mar/o20asktom-098897.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://www.oracle.com/technetwork/issue-archive/2010/10-may/o30asktom-082672.html&quot;&gt;http://www.oracle.com/technetwork/issue-archive/2010/10-may/o30asktom-082672.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/6372565500854347786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=6372565500854347786' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/6372565500854347786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/6372565500854347786'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-invisible-columns.html' title='12c - Invisible Columns...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-7498378790846362270</id><published>2013-07-01T09:27:00.000-04:00</published><updated>2013-07-01T09:28:31.934-04:00</updated><title type='text'>12c - SQL Text Expansion</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Here is another small but very useful new feature in Oracle Database 12c - &lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/d_util.htm#BJEIAEBB&quot;&gt;SQL Text Expansion&lt;/a&gt;. &amp;nbsp;It will come in handy in two cases:&lt;br /&gt;&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;You are asked to tune what looks like a simple query - maybe a two table join with simple predicates. &amp;nbsp;But it turns out the two tables are each views of views of views and so on... In other words, you&#39;ve been asked to &#39;tune&#39; a 15 page query, not a two liner.&lt;/li&gt;&lt;li&gt;You are asked to take a look at a query against tables with VPD (virtual private database) policies. &amp;nbsp;In order words, you have no idea what you are trying to &#39;tune&#39;.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;A new function, EXPAND_SQL_TEXT, in the DBMS_UTILITY package makes seeing what the &quot;real&quot; SQL is quite easy. For example - take the common view ALL_USERS - we can now:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; variable x clob&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dbms_utility.expand_sql_text&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;( input_sql_text =&amp;gt; &#39;select * from all_users&#39;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;output_sql_text =&amp;gt; :x );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;PL/SQL procedure successfully completed.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; print x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;X&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;--------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;SELECT &quot;A1&quot;.&quot;USERNAME&quot; &quot;USERNAME&quot;,&quot;A1&quot;.&quot;USER_ID&quot; &quot;USER_ID&quot;,&quot;A1&quot;.&quot;CREATED&quot; &quot;CREAT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ED&quot;,&quot;A1&quot;.&quot;COMMON&quot; &quot;COMMON&quot; FROM &amp;nbsp;(SELECT &quot;A4&quot;.&quot;NAME&quot; &quot;USERNAME&quot;,&quot;A4&quot;.&quot;USER#&quot; &quot;US&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;ER_ID&quot;,&quot;A4&quot;.&quot;CTIME&quot; &quot;CREATED&quot;,DECODE(BITAND(&quot;A4&quot;.&quot;SPARE1&quot;,128),128,&#39;YES&#39;,&#39;NO&#39;) &quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;COMMON&quot; FROM &quot;SYS&quot;.&quot;USER$&quot; &quot;A4&quot;,&quot;SYS&quot;.&quot;TS$&quot; &quot;A3&quot;,&quot;SYS&quot;.&quot;TS$&quot; &quot;A2&quot; WHERE &quot;A4&quot;.&quot;DA&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;TATS#&quot;=&quot;A3&quot;.&quot;TS#&quot; AND &quot;A4&quot;.&quot;TEMPTS#&quot;=&quot;A2&quot;.&quot;TS#&quot; AND &quot;A4&quot;.&quot;TYPE#&quot;=1) &quot;A1&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now it is easy to see what query is really being executed at runtime - regardless of how many views of views you might have. &amp;nbsp;You can see the expanded text - and that will probably lead you to the conclusion that maybe that 27 table join to 25 tables you don&#39;t even care about might better be written as a two table join.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Further, if you&#39;ve ever tried to figure out what a VPD policy might be doing to your SQL, you know it was hard to do at best. &amp;nbsp;Christian Antognini wrote up a way to sort of see it - but you never get to see the entire SQL statement:&amp;nbsp;&lt;a href=&quot;http://www.antognini.ch/2010/02/tracing-vpd-predicates/&quot;&gt;http://www.antognini.ch/2010/02/tracing-vpd-predicates/&lt;/a&gt;. &amp;nbsp;But now with this function - it becomes rather trivial to see the expanded SQL - after the VPD has been applied. &amp;nbsp;We can see this by setting up a small table with a VPD policy&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create table my_table&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;( &amp;nbsp;data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;varchar2(30),&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; OWNER &amp;nbsp; &amp;nbsp; &amp;nbsp; varchar2(30) default USER&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table created.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;function my_security_function( p_schema in varchar2,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &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; p_object in varchar2 )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp;return varchar2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp;as&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; return &#39;owner = USER&#39;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 8 &amp;nbsp;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 9 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Function created.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp; dbms_rls.add_policy&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; ( object_schema &amp;nbsp; =&amp;gt; user,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; object_name &amp;nbsp; &amp;nbsp; =&amp;gt; &#39;MY_TABLE&#39;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; policy_name &amp;nbsp; &amp;nbsp; =&amp;gt; &#39;MY_POLICY&#39;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; function_schema =&amp;gt; user,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; policy_function =&amp;gt; &#39;My_Security_Function&#39;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp; &amp;nbsp; statement_types =&amp;gt; &#39;select, insert, update, delete&#39; ,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; update_check &amp;nbsp; &amp;nbsp;=&amp;gt; TRUE );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;10 &amp;nbsp;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;11 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;PL/SQL procedure successfully completed.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And then expanding a query against it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dbms_utility.expand_sql_text&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;( input_sql_text =&amp;gt; &#39;select * from my_table&#39;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;output_sql_text =&amp;gt; :x );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;PL/SQL procedure successfully completed.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; print x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;X&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;--------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SELECT &quot;A1&quot;.&quot;DATA&quot; &quot;DATA&quot;,&quot;A1&quot;.&quot;OWNER&quot; &quot;OWNER&quot; FROM &amp;nbsp;(SELECT &quot;A2&quot;.&quot;DATA&quot; &quot;DATA&quot;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;A2&quot;.&quot;OWNER&quot; &quot;OWNER&quot; FROM &quot;OPS$TKYTE&quot;.&quot;MY_TABLE&quot; &quot;A2&quot; WHERE &quot;A2&quot;.&quot;OWNER&quot;=USER@!)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;&quot;A1&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Not an earth shattering new feature - but extremely useful in certain cases. &amp;nbsp;I know I&#39;ll be using it when someone asks me to look at a query that looks simple but has a twenty page plan associated with it!&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/7498378790846362270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=7498378790846362270' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/7498378790846362270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/7498378790846362270'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/07/12c-sql-text-expansion.html' title='12c - SQL Text Expansion'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-3484854566298227604</id><published>2013-06-28T11:37:00.002-04:00</published><updated>2013-06-28T11:37:29.973-04:00</updated><title type='text'>12c - Utl_Call_Stack...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Over the next couple of months, I&#39;ll be writing about some cool new little features of Oracle Database 12c - things that might not make the front page of Oracle.com. &amp;nbsp;I&#39;m going to start with a new package - &lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/u_call_stack.htm#ARPLS74078&quot;&gt;UTL_CALL_STACK&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In the past, developers have had access to three functions to try to figure out &quot;where the heck am I in my code&quot;, they were:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/d_util.htm#i997163&quot;&gt;dbms_utility.format_call_stack&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/d_util.htm#i1003874&quot;&gt;dbms_utility.format_error_backtrace&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/d_util.htm#i1002463&quot;&gt;dbms_utility.format_error_stack&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Now these routines, while useful, were of somewhat limited use. &amp;nbsp;Let&#39;s look at the format_call_stack routine for a reason why. &amp;nbsp;Here is a procedure that will just print out the current call stack for us:&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;procedure Print_Call_Stack&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&amp;nbsp; 3 &amp;nbsp;is&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&amp;nbsp; 4 &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp;DBMS_Output.Put_Line(DBMS_Utility.Format_Call_Stack());&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&amp;nbsp; 6 &amp;nbsp;end;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&amp;nbsp; 7 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;Procedure created.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-indent: -17.280000686645508px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;Now, if we have a package - with nested functions and even duplicated function names:&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;package body Pkg is&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp;procedure p&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp;is&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp;procedure q&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp;is&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;procedure r&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;is&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;procedure p is&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;11 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Print_Call_Stack();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;12 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;raise program_error;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end p;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;14 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;15 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;p();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end r;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;17 &amp;nbsp; &amp;nbsp; &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;18 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;r();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;19 &amp;nbsp; &amp;nbsp; &amp;nbsp;end q;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;20 &amp;nbsp; &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;21 &amp;nbsp; &amp;nbsp; &amp;nbsp;q();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;22 &amp;nbsp; &amp;nbsp;end p;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;23 &amp;nbsp;end Pkg;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;24 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Package body created.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;When we execute the procedure PKG.P - we&#39;ll see as a result:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; exec pkg.p&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;----- PL/SQL Call Stack -----&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; object &amp;nbsp; &amp;nbsp; &amp;nbsp;line &amp;nbsp;object&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; handle &amp;nbsp; &amp;nbsp;number &amp;nbsp;name&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;0x6e891528 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp;procedure OPS$TKYTE.PRINT_CALL_STACK&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;0x6ec4a7c0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10 &amp;nbsp;package body OPS$TKYTE.PKG&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;0x6ec4a7c0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;14 &amp;nbsp;package body OPS$TKYTE.PKG&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;0x6ec4a7c0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;17 &amp;nbsp;package body OPS$TKYTE.PKG&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;0x6ec4a7c0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20 &amp;nbsp;package body OPS$TKYTE.PKG&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;0x76439070 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp;anonymous block&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;BEGIN pkg.p; END;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;*&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ERROR at line 1:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06501: PL/SQL: program error&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 11&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 14&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 17&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 20&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at line 1&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;direction: ltr; margin-bottom: 0pt; margin-left: 0.25in; margin-top: 0pt; text-indent: -0.18in; unicode-bidi: embed; word-break: normal;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;The bit in red above is the output from format_call_stack whereas the bit in black is the error message returned to the client application (it would also be available to you via the format_error_backtrace API call). As you can see - it contains useful information but to use it you would need to parse it - and that can be trickier than it seems. &amp;nbsp;The format of those strings is not set in stone, they have changed over the years (I wrote the &quot;who_am_i&quot;, &quot;who_called_me&quot; functions, I did that by parsing these strings - trust me, they change over time!).&lt;br /&gt;&lt;br /&gt;Starting in 12c - we&#39;ll have structured access to the call stack and a series of API calls to interrogate this structure. &amp;nbsp;I&#39;m going to rewrite the print_call_stack function as follows:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; create or replace&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;2 &amp;nbsp;procedure Print_Call_Stack&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp;as&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp;Depth pls_integer := UTL_Call_Stack.Dynamic_Depth();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp;procedure headers&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp;is&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dbms_output.put_line( &#39;Lexical &amp;nbsp; Depth &amp;nbsp; Line &amp;nbsp; &amp;nbsp;Name&#39; );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dbms_output.put_line( &#39;Depth &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Number &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;11 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dbms_output.put_line( &#39;------- &amp;nbsp; ----- &amp;nbsp; ---- &amp;nbsp; &amp;nbsp;----&#39; );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;12 &amp;nbsp; &amp;nbsp;end headers;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;13 &amp;nbsp; &amp;nbsp;procedure print&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;14 &amp;nbsp; &amp;nbsp;is&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;15 &amp;nbsp; &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;headers;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;17 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for j in reverse 1..Depth loop&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;18 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DBMS_Output.Put_Line(&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;19 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rpad( utl_call_stack.lexical_depth(j), 10 ) ||&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rpad( j, 7) ||&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;21 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rpad( To_Char(UTL_Call_Stack.Unit_Line(j), &#39;99&#39;), 9 ) ||&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;UTL_Call_Stack.Concatenate_Subprogram&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (UTL_Call_Stack.Subprogram(j)));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;24 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end loop;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;25 &amp;nbsp; &amp;nbsp;end;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;26 &amp;nbsp;begin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;27 &amp;nbsp; &amp;nbsp;print;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;28 &amp;nbsp;end;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;29 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here we are able to figure out what &#39;depth&#39; we are in the code (utl_call_stack.dynamic_depth) and then walk up the stack using a loop. &amp;nbsp;We will print out the lexical_depth, along with the line number within the unit we were executing plus - the unit name. &amp;nbsp;And not just any unit name, but the fully qualified, all of the way down to the subprogram name within a package. &amp;nbsp;Not only that - but down to the subprogram name within a subprogram name within a subprogram name. &amp;nbsp;For example - running the PKG.P procedure again results in:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;ops$tkyte%ORA12CR1&amp;gt; exec pkg.p&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;Lexical &amp;nbsp; Depth &amp;nbsp; Line &amp;nbsp; &amp;nbsp;Name&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;Depth &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Number&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;------- &amp;nbsp; ----- &amp;nbsp; ---- &amp;nbsp; &amp;nbsp;----&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; 20 &amp;nbsp; &amp;nbsp; &amp;nbsp;PKG.P&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; 17 &amp;nbsp; &amp;nbsp; &amp;nbsp;PKG.P.Q&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; 14 &amp;nbsp; &amp;nbsp; &amp;nbsp;PKG.P.Q.R&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;PKG.P.Q.R.P&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; 26 &amp;nbsp; &amp;nbsp; &amp;nbsp;PRINT_CALL_STACK&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace;&quot;&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 17 &amp;nbsp; &amp;nbsp; &amp;nbsp;PRINT_CALL_STACK.PRINT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;BEGIN pkg.p; END;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ERROR at line 1:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06501: PL/SQL: program error&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 11&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 14&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 17&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;OPS$TKYTE.PKG&quot;, line 20&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at line 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This time - we get much more than just a line number and a package name as we did previously with format_call_stack. &amp;nbsp;We not only got the line number and package (unit) name - we got the names of the subprograms - we can see that P called Q called R called P as nested subprograms. &amp;nbsp;Also note that we can see a &#39;truer&#39; calling level with the lexical depth, we can see we &quot;stepped&quot; out of the package to call print_call_stack and that in turn called another nested subprogram.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This new package will be a nice addition to everyone&#39;s error logging packages. &amp;nbsp;Of course there are other functions in there to get owner names, the edition in effect when the code was executed and more. See&amp;nbsp;&lt;a href=&quot;http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/u_call_stack.htm#ARPLS74078&quot;&gt;UTL_CALL_STACK&lt;/a&gt;&amp;nbsp;for all of the details.&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&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&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&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;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/3484854566298227604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=3484854566298227604' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3484854566298227604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3484854566298227604'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/06/12c-utlcallstack.html' title='12c - Utl_Call_Stack...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-5511143954598328456</id><published>2013-05-08T14:26:00.002-04:00</published><updated>2013-05-08T14:26:53.727-04:00</updated><title type='text'>Raw Devices...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;A quick request...&lt;br /&gt;&lt;br /&gt;If you are using RAW devices for your database (no ASM, no filesystem - just &#39;raw&#39;) - please &lt;a href=&quot;mailto:thomas.kyte@oracle.com&quot;&gt;drop me a line &lt;/a&gt;and let me know. &amp;nbsp;Include the size of &amp;nbsp;your database as well please.&lt;br /&gt;&lt;br /&gt;thanks!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/5511143954598328456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=5511143954598328456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/5511143954598328456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/5511143954598328456'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/05/raw-devices.html' title='Raw Devices...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-3649031394595854548</id><published>2013-01-18T10:28:00.001-05:00</published><updated>2013-01-29T09:01:47.794-05:00</updated><title type='text'>You can&#39;t trust everything you see...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;A few years ago, I wrote a book - &lt;a href=&quot;http://www.amazon.com/dp/0072230657?tag=asktom03-20&amp;amp;camp=14573&amp;amp;creative=327641&amp;amp;linkCode=as1&amp;amp;creativeASIN=0072230657&amp;amp;adid=05D2JRJ6ATG1VT94JH7N&amp;amp;&amp;amp;ref-refURL=&quot;&gt;Effective Oracle by Design&lt;/a&gt;. &amp;nbsp;Oracle Press really wanted my photo on the book and I really didn&#39;t want it. &amp;nbsp;So they went around me and asked Oracle Magazine for the head shot they had and were using for the print column back then. &amp;nbsp;Unbeknownst to Oracle Press - that head shot was a photoshop job. &amp;nbsp;It was my head, someone else&#39;s body. &amp;nbsp;I never did find out whose body it was - but it was definitely not me. &amp;nbsp;If you have the book and look really close - you can see the line on my neck where they slid my head on.&lt;br /&gt;&lt;br /&gt;I just got the latest issue of Oracle Magazine and lo and behold - they&#39;ve done it again. &amp;nbsp;My column has a new picture of me on the intro page, one that I&#39;ve never seen before - but only because it never happened in real lift. &amp;nbsp;Again - it is my head from a shot I recognize, but on someone else&#39;s body - not just neck and shoulders this time - but the full body!&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-Bu-2Ycevl8Y/UPlo6tsv1WI/AAAAAAAAAIU/uv78-YqCSY8/s1600/asktom.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/-Bu-2Ycevl8Y/UPlo6tsv1WI/AAAAAAAAAIU/uv78-YqCSY8/s1600/asktom.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This time - I know where the body came from. &amp;nbsp;In an effort to make people as unproductive as possible - I&#39;m going to offer up a challenge. &amp;nbsp;If you can point me to the source of the body shot on the internet, I&#39;ll send you a copy of Expert Oracle Database Architecture - 3rd edition when it comes out (which will be a while, sometime in 2013 - I&#39;m not starting the edits on it until the next release of the database is official).&lt;br /&gt;&lt;br /&gt;In order to play - supply a link to the source body here in the comments. &amp;nbsp;Make sure to use an identifiable username (do not use anonymous) or identify yourself in some way in the comment. &amp;nbsp;If you are the first to get it right - I&#39;ll post a comment myself stating so and ask you to email me so I can get your contact information (so you&#39;ll have to check back every now and then). &amp;nbsp;When the book is printed, I&#39;ll send you a signed copy. &lt;span style=&quot;color: white;&quot;&gt;table 42 :))))))&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/3649031394595854548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=3649031394595854548' title='54 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3649031394595854548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3649031394595854548'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2013/01/you-cant-trust-everything-you-see.html' title='You can&#39;t trust everything you see...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-Bu-2Ycevl8Y/UPlo6tsv1WI/AAAAAAAAAIU/uv78-YqCSY8/s72-c/asktom.jpg" height="72" width="72"/><thr:total>54</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-8410462515596862592</id><published>2012-08-17T17:35:00.003-04:00</published><updated>2012-08-17T17:39:35.072-04:00</updated><title type='text'>The keys to Oracle…</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;This is a question I get on asktom frequently – what are the things I need to know, what do I have to do to become expert, where is the list of key things I need to do with regards to Oracle.&amp;nbsp; It is a hard sounding question that has an easy answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;If you are still wet behind the ears – or even just damp – then the definitive place to start is the &lt;a href=&quot;http://www.oracle.com/pls/db112/to_toc?pathname=server.112/e25789/toc.htm&quot;&gt;Oracle Server Concepts Guide&lt;/a&gt;. Not only is this free - but it is your guide to understanding how the database works. &amp;nbsp;If you understand something - you can use that thing. &amp;nbsp;If you don&#39;t, well, simply put - you won&#39;t be able to effectively use it. &amp;nbsp;Getting a solid knowledge of how a transaction is done, what locking and concurrency controls are and how they work, how the database makes the data durable on disk (redo, undo management) - all of it is key to effectively using the database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;If you don&#39;t know who can see what data, which version of data, at what points in time - confusion will abound and data integrity will be lost. &amp;nbsp;Getting a good basic knowledge of how the database manages data is the only way for you to know how to code a correct program.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Once you&#39;ve mastered the material in that document - I would suggest taking a look at the 2-Day guides. &amp;nbsp;They are a good way to get spun up on the necessary knowledge for either a Developer or DBA track. There is the &lt;a href=&quot;http://www.oracle.com/pls/db112/to_toc?pathname=appdev.112/e10766/toc.htm&quot;&gt;2-Day Developers Guide&lt;/a&gt; and the &lt;a href=&quot;http://www.oracle.com/pls/db112/to_toc?pathname=server.112/e10897/toc.htm&quot;&gt;2-Day DBA Guide&lt;/a&gt;. &amp;nbsp;These documents are designed to get you going - you won&#39;t be an expert after reading them, but you&#39;ll know the gist of what it is you need to know, to learn. &amp;nbsp;You&#39;ll have a good idea of what is available feature wise at the very least.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;After these 2-Day guides (you can read either one or both), you might want to move onto some of the other overview guides - the &lt;a href=&quot;http://www.oracle.com/pls/db112/to_toc?pathname=server.112/e10822/toc.htm&quot;&gt;2-Day Performance&lt;/a&gt; would be a must read for anyone (followed by the &lt;a href=&quot;http://www.oracle.com/pls/db112/to_toc?pathname=server.112%2Fe16638%2Ftoc.htm&amp;amp;remark=portal+%28Books%29&quot;&gt;Performance Guide&lt;/a&gt; itself eventually).&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;While all of this is going on - you should also be communicating - a lot. &amp;nbsp;Constantly. &amp;nbsp;Get on the forums - &lt;a href=&quot;http://otn.oracle.com/forums&quot;&gt;http://otn.oracle.com/forums&lt;/a&gt;, start writing - start asking questions (after reading the guidelines!!), start participating. &amp;nbsp;It&lt;a href=&quot;http://tkyte.blogspot.com/2005/05/success.html&quot;&gt; is the way&lt;/a&gt; I learned much of what I know now myself. &amp;nbsp;But communicate - a lot. &amp;nbsp;You won&#39;t be able to progress forward in a vacuum. &amp;nbsp;Share everything you have in your head - and find others that will share back with you. &amp;nbsp;You&#39;ll find you not only get to learn (and to teach eventually) from people all over the world - but you may end up calling some of them your really good friends.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;And then add time, a lot of time. &amp;nbsp;Maybe years of time. &amp;nbsp;You will not become really good at what you are doing in six months, not in a year, probably not in five years. &amp;nbsp;It will take a while - you need to have lots of different experiences, encounter many different situations, attempt and fail to solve many problems - before you&#39;ll become really good at what you do. &amp;nbsp;You might feel like you are expert in a year - but trust me - you aren&#39;t. &amp;nbsp;And four years later you&#39;ll realize how little you knew and how much more you have to learn.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;I learn something new everyday about Oracle, just the other day something about &lt;a href=&quot;http://tkyte.blogspot.com/2012/08/what-i-learned-new-about-total-recall.html&quot;&gt;Total Recall&lt;/a&gt; but many &lt;a href=&quot;https://www.google.com/search?q=site%3Atkyte.blogspot.com+what+I+learned+new&quot;&gt;things in general&lt;/a&gt;, technical and otherwise - and I&#39;ve been doing Oracle things for a long time.&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;:)))))))))))))&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/8410462515596862592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=8410462515596862592' title='23 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8410462515596862592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8410462515596862592'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/08/the-keys-to-oracle.html' title='The keys to Oracle…'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>23</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-8434355125408372690</id><published>2012-08-13T14:15:00.000-04:00</published><updated>2012-08-15T09:31:10.733-04:00</updated><title type='text'>Coming soon to Ireland and the Netherlands...</title><content type='html'>In September I&#39;ll be delivering a free Seminar in Dublin Ireland from 9am till 2:30pm on September 19th at the Gibson Hotel. &amp;nbsp;It is being delivered in conjunction with the Ireland OUG and anyone (even non-members) may attend. &amp;nbsp;Food is involved so it is a real deal :) &amp;nbsp;I&#39;ll be talking about big data, statistics and managing large sets of data. &amp;nbsp;We&#39;ll close up with a Q&amp;amp;A session before lunch. &amp;nbsp;Full details on registering and the agenda &lt;a href=&quot;https://asktom.oracle.com/pls/apex/z?p_url=ASKTOM%2Edownload_file%3Fp_file%3D67665192018289029700&amp;amp;p_cat=Tom%20Kyte%20Seminar%20Dublin%20Sep%202012.pdf&amp;amp;p_company=822925097021874&quot;&gt;may be found here.&lt;/a&gt;&amp;nbsp; Also see the &lt;a href=&quot;http://www.ukoug.org/events/tom-kyte-seminar-and-asktom-live-dublin&quot;&gt;Ireland Oracle User Group page.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After that, on September 20th, I&#39;ll be delivering a full day seminar with Oracle University in Utrecht in the Netherlands. &amp;nbsp;Full details - including the agenda -&lt;a href=&quot;http://www.oracle.com/nl/education/eblast/nl-tomkyte-event-040412-ol-1576790.html&quot;&gt; may be found here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope to see you at one of the events!&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;:))))))&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/8434355125408372690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=8434355125408372690' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8434355125408372690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/8434355125408372690'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/08/coming-soon-to-ireland-and-netherlands.html' title='Coming soon to Ireland and the Netherlands...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-2753731232433590910</id><published>2012-08-09T08:26:00.003-04:00</published><updated>2012-08-09T08:45:56.375-04:00</updated><title type='text'>What I learned new about Total Recall...</title><content type='html'>Today I learned something new about the Oracle Total Recall option from a good friend (they were very happy to have told me something about Oracle I didn&#39;t know :) ) - it doesn&#39;t exist anymore! &amp;nbsp;The Total Recall option has been made part of the Advanced Compression option!!&lt;br /&gt;&lt;br /&gt;Check this out&amp;nbsp;&lt;a href=&quot;http://docs.oracle.com/cd/E11882_01/license.112/e10594/options.htm#CJACCDBA&quot; target=&quot;_blank&quot;&gt;http://docs.oracle.com/cd/E11882_01/license.112/e10594/options.htm#CJACCDBA&lt;/a&gt;&amp;nbsp;to see what you get with the Advanced Compression option which now includes the Total Recall option as well - the Flashback Data Archive capability.&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;:)))))))))))&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/2753731232433590910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=2753731232433590910' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/2753731232433590910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/2753731232433590910'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/08/what-i-learned-new-about-total-recall.html' title='What I learned new about Total Recall...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-3285038429205457378</id><published>2012-08-06T14:15:00.002-04:00</published><updated>2012-08-06T14:45:23.295-04:00</updated><title type='text'>Latin America OTN Tour....</title><content type='html'>Just starting the Latin American OTN tour for the week here in Uruguay. &lt;br /&gt;&lt;br /&gt;This is my first time in Uruguay and I spent the weekend in Montevideo. &amp;nbsp;It was a wet, damp weekend - very foggy too! &amp;nbsp;But on the plus side - the food is excellent and plentiful. &amp;nbsp;The local user group leaders here made sure we were well fed and warm for lunch every day :)&lt;br /&gt;&lt;br /&gt;Today is the OTN conference -&amp;nbsp;Dimitri Gielis is presenting right now using a &quot;slide free&quot; presentation. &amp;nbsp;He is building an APEX application to the specification of the audience, in real time. &amp;nbsp;A pretty neat concept, I like it, very good way to show the ability of the tool:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.flickr.com/photos/tkyte/7726964692/&quot; title=&quot;2012-08-06_14-57-22_202 by tom_kyte, on Flickr&quot;&gt;&lt;img alt=&quot;2012-08-06_14-57-22_202&quot; height=&quot;282&quot; src=&quot;http://farm9.staticflickr.com/8289/7726964692_896c94b10e.jpg&quot; width=&quot;500&quot; /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;Tomorrow Andrew Holdsworth, Graham Wood and I are doing a Real World Performance day here before we are off to Argentina for a repeat. &amp;nbsp;To get to Argentina, we are going to a three hour ferry ride. &amp;nbsp;It is supposed to rain - so that will be a damp, wet trip for sure.&lt;br /&gt;&lt;br /&gt;After Argentina we&#39;ll be off for Sao Paulo Brazil for a repeat on Saturday (yes, Saturday!).&lt;br /&gt;&lt;br /&gt;If you are in the area, you can find the details here:&amp;nbsp;&lt;a href=&quot;http://www.oracle.com/technetwork/es/community/user-groups/otn-latinoamerica-tour-2012-1634120-esa.html&quot;&gt;http://www.oracle.com/technetwork/es/community/user-groups/otn-latinoamerica-tour-2012-1634120-esa.html&lt;/a&gt;&amp;nbsp; or on&amp;nbsp;&lt;a href=&quot;http://asktom.oracle.com/&quot;&gt;http://asktom.oracle.com&lt;/a&gt;. &amp;nbsp;Hope to see you here!&lt;br /&gt;&lt;br /&gt;Now I&#39;m off to answer some questions that I have in my queue... &lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;:)))))))))))&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/3285038429205457378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=3285038429205457378' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3285038429205457378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/3285038429205457378'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/08/latin-america-otn-tour.html' title='Latin America OTN Tour....'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-5915414798851320303</id><published>2012-06-16T03:39:00.001-04:00</published><updated>2012-06-16T03:39:14.819-04:00</updated><title type='text'>East Coast Oracle Users Group Conference...</title><content type='html'>I&#39;ll be speaking at the &lt;a href=&quot;http://eastcoastoracle.org/&quot;&gt;East Coast Oracle Users Group Conference&lt;/a&gt; held in North Carolina on October 16th-18th. &amp;nbsp;It is always nice to be able to stay in my own timezone for a change!&lt;br /&gt;&lt;br /&gt;There are opportunities to not only attend the conference but also to speak - they are&lt;a href=&quot;http://eastcoastoracle.org/ssl/presentations.asp&quot;&gt; still accepting abstracts for presentations&lt;/a&gt;&amp;nbsp;until June 21st. &amp;nbsp;If you have done anything interesting (you have), please consider speaking out about it. &amp;nbsp;Others will be interested. &amp;nbsp;&lt;a href=&quot;http://tkyte.blogspot.com/2005/10/speaking-out-loud.html&quot;&gt;You never know how it will go&lt;/a&gt; unless you try!&lt;br /&gt;&lt;br /&gt;Hope to see you there!</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/5915414798851320303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=5915414798851320303' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/5915414798851320303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/5915414798851320303'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/06/east-coast-oracle-users-group.html' title='East Coast Oracle Users Group Conference...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-921749739312543795</id><published>2012-05-27T11:38:00.001-04:00</published><updated>2012-05-27T11:38:25.343-04:00</updated><title type='text'>Doctors...</title><content type='html'>This recent &lt;a href=&quot;http://sethgodin.typepad.com/seths_blog/2012/05/emergency-room-doctors.html?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+typepad%2Fsethsmainblog+%28Seth%27s+Blog%29&quot;&gt;blog post by Seth Godin&lt;/a&gt; reminded me a lot of my introduction to Effective Oracle by Design of a few years ago. What was true then is still so true today...&lt;br /&gt;&lt;br /&gt;Here is an excerpt from my book that mirrors what he just wrote:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;I will use yet another analogy to describe how this book will present information.&amp;nbsp; Pretend for a moment that the developer is instead a medical doctor and the application is the patient.&amp;nbsp; There are many types of MD’s:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;importantwords-PRODUCTION&quot;&gt;The      emergency room (ER) doctor&lt;/span&gt;. They do “triage” – separating      the hopeless from the ones that can be helped.&amp;nbsp; Performing quick fixes to keep patients      alive for as long as possible.&amp;nbsp; They      strive for short term band-aids to fix up the patient.&amp;nbsp; They will take a patient with a heart      attack induced by smoking, bad diet and no exercise and get them      stabilized.&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;importantwords-PRODUCTION&quot;&gt;The      operating room (OR) doctor.&lt;/span&gt;&amp;nbsp;      They get the patient after the ER doctor has triaged them and      patched them up.&amp;nbsp; They strive for      long term fixes to keep the patient not only alive but as fully      functioning as possible.&amp;nbsp; They      perform the by-pass operation on that heart attack attempting to clear the      arteries.&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;importantwords-PRODUCTION&quot;&gt;The      physical therapist (PT).&lt;/span&gt;&amp;nbsp;      They get the patient after the operating room doctor is finished      and begin a long and painful (not to mention expensive) process of      rehabilitation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;importantwords-PRODUCTION&quot;&gt;The      preventative medicine doctor.&lt;/span&gt;&amp;nbsp; They strive to avoid the above three      doctors at all costs.&amp;nbsp; They counsel      the patient to quit smoking, eat a healthy diet, and exercise – developing      a phased plan to get them in shape.&amp;nbsp;      If they do their job right – with the exception of unfortunate      accidents (like a car accident), the patient will never see the ER, OR or      PT doctors.&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;Now, the world needs all types of doctors – accidents do happen after all.&amp;nbsp; But one of the most important types of doctors is that last one, the preventative medicine doctor.&amp;nbsp; The one that tries hard to avoid having their patient need the other three.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;It is my belief (experience) that most people and books approach tuning using the mindset of the first three doctor types above.&amp;nbsp; They are in support of the &lt;span class=&quot;importantwords-PRODUCTION&quot;&gt;hero developer&lt;/span&gt;; e.g. the ER or OR doctor.&amp;nbsp; Perhaps that is partially due to my observation that pre-emptive good design and implementation is mostly a thankless exercise.&amp;nbsp; These developers seem to get all of the fame as they snatch the patient from the grasp of death (save the system by doing something miraculous).&amp;nbsp; They get called in at the last moment; work horribly hard for an extended period of time trying to keep the patient alive (and get paid handsomely as well).&amp;nbsp; The physical therapists are the unlucky souls that get the system after the ER/OR doctor has patched it up.&amp;nbsp; They are the ones responsible for keeping this system going.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;I feel I am well equipped to speak from that perspective.&amp;nbsp; I am in fact one of those “heroes”.&amp;nbsp; I am called in to “lay hands on” systems and make them better.&amp;nbsp; I could write that book, I’ve been told I should write that book – but I won’t.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoBodyText&quot;&gt;What is missing is the comprehensive approach that includes the preventative medicine doctor training.&amp;nbsp; There are some out there – my favorites being Guy Harrison’s developer book, as well as Jonathan Lewis’s DBA book.&amp;nbsp; These books, including my own “Expert One on One Oracle” work to remove the need for the hero.&amp;nbsp; Remember – firefighters are heroes when they do their job, we all just hope &lt;b&gt;we&lt;/b&gt;never need them personally!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/921749739312543795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=921749739312543795' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/921749739312543795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/921749739312543795'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/05/doctors.html' title='Doctors...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-2356810001932284199</id><published>2012-05-23T16:57:00.003-04:00</published><updated>2012-05-23T17:55:23.797-04:00</updated><title type='text'>When is a foreign key not a foreign key...</title><content type='html'>I learn or relearn something new every day about Oracle. &amp;nbsp;Just about every day really!&lt;br /&gt;&lt;br /&gt;Last week I was in Belgrade Serbia delivering a seminar and an attendee reminded me of something I knew once but had totally forgotten about. &amp;nbsp;It had to do with foreign keys and the dreaded NULL value.&lt;br /&gt;&lt;br /&gt;Many of you might think the following to be not possible, we&#39;ll start with the tables:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops$tkyte%ORA11GR2&amp;gt; create table p&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;( x int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp;y int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp;z int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp;constraint p_pk primary key(x,y)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Table created.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops$tkyte%ORA11GR2&amp;gt; create table c&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;( x int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp;y int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp;z int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp;constraint c_fk_p foreign key (x,y) references p(x,y)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Table created.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Looks like a normal parent child relationship - a row may exist in C &lt;i&gt;&lt;b&gt;if and only if&lt;/b&gt; &lt;/i&gt;a parent row exists in P. &amp;nbsp;If that is true - then how can this happen:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops$tkyte%ORA11GR2&amp;gt; select count( x||y ) from p;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;COUNT(X||Y)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-----------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops$tkyte%ORA11GR2&amp;gt; select count( x||y ) from c;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;COUNT(X||Y)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-----------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are zero records in P - none. &amp;nbsp;There is at least one record in C and that record has a non-null foreign key. &amp;nbsp;What is happening?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It has to do with NULLs and foreign keys and the default &quot;MATCH NONE&quot; rule in place. &amp;nbsp;If your foreign key allows NULLs and your foreign key is a composite key - then you must be careful of the condition where by only SOME of the foreign key attributes are not null. &amp;nbsp;For example - to achieve the above magic, I inserted:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops$tkyte%ORA11GR2&amp;gt; insert into c values ( 1, null, 0 );&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;1 row created.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The database cannot validate a foreign key when it is partially null. &amp;nbsp;In order to enforce the &quot;MATCH FULL&quot; option of a foreign key - you would want to add a constraint to your table:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops$tkyte%ORA11GR2&amp;gt; alter table c add constraint check_nullness&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;check ( ( x is not null and y is not null ) or&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;( x is null and y is null ) )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp;/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Table altered.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That will ensure either:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;All of the columns are NULL in the foreign key&lt;/li&gt;&lt;li&gt;None of the columns are NULL in the foreign key&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;As long as that constraint is in place - your foreign key will work as &amp;nbsp;you probably think it should work.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;See also:&amp;nbsp;&lt;a href=&quot;http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_constraints.htm#ADFNS273&quot;&gt;http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_constraints.htm#ADFNS273&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/2356810001932284199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=2356810001932284199' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/2356810001932284199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/2356810001932284199'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/05/when-is-foreign-key-not-foreign-key.html' title='When is a foreign key not a foreign key...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11839365.post-4217915108485644650</id><published>2012-05-15T12:14:00.000-04:00</published><updated>2012-05-15T12:15:27.545-04:00</updated><title type='text'>UKOUG 2012...</title><content type='html'>The &lt;a href=&quot;http://2012.ukoug.org/default.asp?p=9306&quot;&gt;call for papers&lt;/a&gt; for the UKOUG 2012 conference ends in less than three short weeks! &amp;nbsp;If you were planning on going to the conference (and even if not) - you should consider submitting a paper.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I&#39;ve been a long time supporter of all of the user groups and their conferences and I can attest to the quality of the UKOUG event. &amp;nbsp;The conference is chock full of technical talks with hundreds of sessions to choose from. &amp;nbsp;There is something for everyone there.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you&#39;ve never presented before, don&#39;t let that deter you from submitting a paper. &amp;nbsp;No one knows the&amp;nbsp;anxiety that public speaking can bring better than I - &lt;a href=&quot;http://tkyte.blogspot.com/2005/10/speaking-out-loud.html&quot;&gt;I&#39;ve written about it before&lt;/a&gt;.&amp;nbsp;You&#39;ll find the conference to be an entirely different experience on the other side of the podium. &amp;nbsp;In addition to the experience of presenting, the networking and exposure that comes with being a speaker won&#39;t hurt you at all. &amp;nbsp;Whether you are a DBA or developer - having good public speaking skills is a necessity today - and using the conference as a way to build those skills is a great way to start.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Additionally - what you have to say is important and relevant to the user community as a whole. &amp;nbsp;A good conference needs a lot of speakers, from many diverse&amp;nbsp;disciplines, with diverse backgrounds - the more speakers the merrier. &amp;nbsp;Don&#39;t think you don&#39;t have anything to offer - everyone does. &amp;nbsp;And don&#39;t feel that your topic wouldn&#39;t be interesting to someone else - it will be. &amp;nbsp;There are a lot of people out there trying to do some of the same things you&#39;ve done and they&#39;d love to hear how you did it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That is one of the things about user groups I really like - they bring together a lot of people doing similar things - but in a different way. &amp;nbsp;You&#39;ll learn something new - and they will too. &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The UKOUG is one of the larger and well run conferences out there - don&#39;t be afraid to talk. &amp;nbsp;Challenge yourself to get up there and just do it. &amp;nbsp;You won&#39;t be sorry (ok, maybe in the minutes leading up to it you will be - but you&#39;ll get over that :) )&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hope to see you there - and don&#39;t chicken out!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tkyte.blogspot.com/feeds/4217915108485644650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11839365&amp;postID=4217915108485644650' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4217915108485644650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11839365/posts/default/4217915108485644650'/><link rel='alternate' type='text/html' href='http://tkyte.blogspot.com/2012/05/ukoug-2012.html' title='UKOUG 2012...'/><author><name>Thomas Kyte</name><uri>http://www.blogger.com/profile/16414894020465518692</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_IxinUpKAs5M/S_5YHppw_cI/AAAAAAAAAAM/pU6wdtJGoQM/S220/AIbEiAIAAABECKW-s5WbvqeGhgEiC3ZjYXJkX3Bob3RvKigzODIwMDI0MmJjMjEwYjYxMGUyMjAyZDJkMDMzYjhlYTNmY2ViMzliMAG2Ia-cTjf6DRbcogWdq0L5XaBO-w.jpg'/></author><thr:total>4</thr:total></entry></feed>