Who's online

There are currently 0 users and 19 guests online.

Recent comments


Things that are there but you cannot use

I did a "desc" command on the STANDARD package today, the package that helps define PL/SQL, and saw the XOR function!

SQL> declare
  2    x boolean;
  3  begin
  4    x := XOR(true,true);
  5    dbms_output.put_line(case when x then 'TRUE' else 'FALSE' end);
  7    x := XOR(true,false);
  8    dbms_output.put_line(case when x then 'TRUE' else 'FALSE' end);
 10    x := XOR(false,false);
 11    dbms_output.put_line(case when x then 'TRUE' else 'FALSE' end);
 13  end;
 14  /

PL/SQL procedure successfully completed.

I cant find any reference to it in the Oracle PL/SQL documentation anywhere, so its definitely not supported so using it is probably off limits until you see officially in the documentation.

SQL Text / View Expansion

One of the common issues faced when debugging or investigating SQL performance is that tools often do not not show the underlying objects at play when a query involves views.

Oracle 12c now provides a capability to display the underlying objects; DBMS_UTILITY.EXPAND_SQL_TEXT will provide the entire syntax of the”exploded” query as shown below:

Example EXPAND_SQL_TEXT – View Definition:

create view dept_emps
 select dname,loc,d.deptno,
   from emp e join dept d
     on e.deptno = d.deptno
   order by dname,ename;


Here’s a query using the view, unless you know the schema you might not realize multiple database objects were in use.

select * from dept_emps;

Here’s the PL/SQL you might use to “expand” the SQL text to show the objects really involved:

Oracle 12 and latches, part 2

In my previous post, I looked at non shared latches and how the latching is done by Oracle. This post is a description on how the latching works for shared latches.

The information is quite internal, if you landed on this page it might be a good idea to start with my first post on this topic: first post.

A famous example for shared latches is the ‘cache buffers chains’ latch.

For the sake of the test I quite randomly scanned a test table, and had a little gdb script to look at the function call ksl_get_shared_latch:

Delphix Express – a free version of Delphix


#555555;">#2970a6;" href="">2401421989_e05053cbf7_z


#555555; text-align: right;">photo by #212124;" title="Go to Yannis's photostream" href="" data-track="attributionNameClick" data-rapid_p="48">Yannis (CC 2.0)

Continuous Delivery – Moving to SECUREFILE

You’ve been google-ing and you’ve seen articles (for example) like and you’re pretty pumped about using SECUREFILE features.  You’ve got lots of existing CLOB data and moving to SECUREFILE is going to make your life much easier.  You’re also excited about the fact that none of your code has to change – you just change the existing CLOB columns to be stored as SECUREFILE and you’ll have set yourself up for all sorts of feature goodness !

But how do we do it in a continuous delivery (CD) model ?  Because moving CLOB’s sounds like downtime doesn’t it ?

And by default, that’s exactly what it will be.  Let’s explore that with a faux application that uses CLOB’s.

Continuous delivery…

“Continuous Delivery (CD) is a software engineering approach in which teams keep producing valuable software in short cycles and ensure that the software can be reliably released at any time”


Perhaps a simpler definition is “CD is the currently the cool thing to do” Smile

Sarcasm aside, there’s a lot of common sense in being able to rapidly push out software changes in a safe manner. 

Partial uniqueness

I had an interesting request recently from a developer.

“ I have a table created as per below

create table C_TEST (
  col_1 varchar2(3),
  col_2 varchar2(3),
  col_3 number

The rows defined by col_1, col_2, col_3 must be unique but only when col_3 is present.  If col_3 is not present, then we allow anything.  Hence if the table is populated like this:

Oracle Developer awards…chosen by Developers

I was reading the following post today

Oracle are planning on rewarding developers in the following areas:

  • SQL
  • PL/SQL
  • Oracle REST Data Services
  • Oracle Application Express
  • Database Design


At first glance I had a bit of a cynical view…it could easily be one of those things where if you come from a company that has massive investment in Oracle, then surprise surprise you float to the top of the heap. 

But this part of the post caught my eye:

The technology community

I remember on a flight to the UKOUG, I was doing what all presenters typically do on a plane.  They enter the cabin with the thought of "OK, I’ll spend most of the flight getting those slides just right".  Then…a set of broadcast advertisements, safety messages, hot face towels, exit row briefings, beverage services, coffee services, and before you know it you’ve burned 2 hours without touching the laptop…and then the meal service starts :-)

Anyway, I digress.  I eventually got the laptop fired up and started flicking through my slides for the 800th time – I suffer from that silliness where if I’m thinking "Hmmm, if replace with ‘database’ with ’12c database’", then this somehow will make a significant improvement for the attendees.  After a while the laptop gives me a little ‘beep’ telling me that battery is low.

Good new SQL tuning book

People ask me from time to time what are some good SQL tuning books. It’s a tough question to answer. There are some seminal books such as “SQL Tuning” by Dan Tow and “Cost Based Optimizer Fundamentals” by Jonathan Lewis, but these are advanced books  that few I know have actually read from cover to cover. If you are looking for practical SQL tuning cookbooks you might want something a little less advanced.  For a practical approach, I love “Refactoring SQL Applications” by #111111;"> Stephane Faroult which is an easy read, again, it’s not a straight forward SQL tuning book.