Fun with array fetch

I’ve lost track of the number of times I’ve worked with systems that didn’t run brilliantly because every database operation was the “row at a time” methodology.  Typically you see hundreds of routines (either in the database in PL/SQL) or further up the chain in C#, Java etc, and the “alarm bells” start ringing in my head when all of those routines are prefixed with “GET_” and the input parameter looks like a primary (more...)


I’m a bit of a dinosaur when it comes to how long I’ve been using Oracle.  But you should never stop learning.  That’s why I’m participating in a cool OpenWorld session in a few weeks, all about the modern technologies and frameworks that can now be used to build awesome applications on top of the Oracle database.  Come along – you’ll see some exciting stuff.  This session is all about modern (more...)

exitcommit … or your career down the drain

I recently posted a little video on the ‘exitcommit’ option in SQL Plus, adding a theatrical drama to present a worst case scenario of potentially destroying a Production system.  Take 3 mins to have a chuckle here.

My predecessor Natalka Roshak tweeted an interesting followup that I thought I would share, namely, if you’re a regular SQL Plus user, you should definitely take the time to check out the (more...)

Connection shortcuts with a wallet

I’m lazy when I connect to the database, especially on my laptop.  Anything that saves a few keystrokes I’m keen on Smile

So rather than type “sqlplus username/password@database” I like to take advantage of a wallet

In my private sqlnet.ora, or the global one if it makes sense to do so, I add the details of wallet


This tells Oracle, that when I begins a connection to the database, we will (more...)

Row transposition

Here’s a couple of simple examples to get you started with transposing rows to columns. The problem typically presents as:

How do you convert a listing in rows (eg, where people placed in a race), into some output that is across the page ?

For example, given a running race, how do you generate output which looks like this:


So here’s our source table

SQL>  (more...)

Lets Talk DB Perth

Last week in Perth, we held a “Lets Talk DB” event.  This was a free event organised by our local Perth Oracle office (big thanks to Dennis Ward for his organisational skills), where Richard Foote, Chris Muir and myself, spent the day describing some of the Oracle innovations to DBA and Developers alike.  Chris referred to the three of us as the “Coalition of the Delisted” for we are all former Ace (more...)

Longer strings in 12c

Most people are now aware that in 12c, a VARCHAR2 has been extended from a maximum size of 4000 to 32767 bytes.

Similarly, there’s many a note/blog post etc about needing to set the following parameter to enable it:

SQL> alter system set max_string_size = EXTENDED scope=spfile;

System altered.

and then bounce the database. But its important note that its NOT just as simple as that. Here’s what will happen if you only do that

Presenting in Perth on September 9th, 2015

I’ll be presenting at a “Lets Talk Oracle” event in Perth, with fellow Ex-Oracle ACE Directors Richard Foote and Chris Muir. Full agenda as follows:

8:30-9:00   Registration and coffee
9:00-10:30  Richard Part I – Database 12c New Features for DBAs (and Developers)
10:30-11:00 Break
11:00-12:30 Richard Part II – Database 12c New Features for DBAs (and Developers)
12:30-1:30  Lunch
1:30-2:30   Chris – Creating RESTful APIs with Oracle Data Services (for Developers and DBAs)
2:30-2:45   Break

Less calls…more performance (part 2)

In the previous post, I mentioned that for a programming environment fetching rows from the database, then the method of

  • open a ref cursor
  • issue a fetch call
  • close the ref cursor

might not be appropriate for those situations where the result set is known be a single row (eg primary key lookup).

A better option might be to call a procedure and get those outputs as parameters.

And I broke a cardinal rule… (more...)

Less calls…more performance

In various programming environments, a common metaphor is to open a cursor on the database (a REF CURSOR in Oracle parlance), return that cursor handle to the calling environment, and then that cursor is used to fetch or “fill” a data object, which may map to a grid on screen, or just to an array in memory.

And that’s totally fine – its an effective means to obtain a result set from the database to (more...)