Skip to main content

The PL/SQL Whisperer

[oreiginally published at FeuerThoughts in December 2011]

I spent two days in Berlin, training 25 developers at an event sponsored by DOAG. Then I headed over to the Netherlands to spend a couple of days with 37 developers at an AMIS-sponsored training.

But on Tuesday, after I completed the first day of training without the assistance of a microphone, my voice said "Bye, bye!" I woke up Wednesday morning to discover I had lost the ability to speak above a whisper. DOAG hustled, did what was necessary, and brought in a portable microphone/speaker system. AMIS made certain to have the same ready to go on Thursday. 

And so for three straight days, I whispered about new features of PL/SQL in 11g and much more besides. The attendees were very good natured about this less than optimal situation. One person said it made the whole class more exciting - it was as though I was giving away secrets, that no one should hear- except for the very special people in attendance.

Several students in the Dutch class even found themselves whispering to me when they asked a question - whispering, it turns out, is socially contagious! And I was quickly anointed the "PL/SQL Whisperer." Well, I can think of worse names, but I sure hope that soon I will recover my voice.

This was only my fourth business trip all year, which is a truly wonderful change from previous years (a less than fantastic result is that I will lose my Platinum status on American Airlines next week, so it will be tough to even get exit row seats when I do fly).

It was, unfortunately, a bit of a hard week on the road. Besides losing my voice, my flight on Wednesday from Berlin to Amsterdam was cancelled. I had to reroute through Zurich, but the flight to Zurich left late, so while I was able to just make the connection to Amsterdam, my bag did not follow along with me. By the end of the first day of training at AMIS offices, I had quite the five o'clock shadow. But the bag was delivered on Thursday, so it wasn't really such a big deal.

And then on Friday, I celebrated the end of a long week with a night in Amsterdam. Had a nice dinner with good friend, newly-minted Oracle ACE, AMIS consultant and father of three wonderful children, Patrick Barel. Then I went back to my hotel room to catch up on email and call my wife via Skype.

But the wireless network was not available. So the manager dutifully visited my room with an ethernet cable and (as far as I could tell) had to jam the cable a bit forcefully both into the wall and into my laptop. That made me uncomfortable. And still no Internet access.

So then he agreed to let me use the Internet in a different room - which led to a very irritating discovery: the ethernet plug would not come out of the back of the laptop. The spring that holds the cable in place had snapped. Manager Jon poked at it for a while, making me more uncomfortable, but it would not come out. Oh, I was very bummed and finally gave up, had him cut the cable so I could take the darn thing home, and figured I would have to have a technician get it out.

Yuch.

But then the day manager visited in the morning before I left for the airport. He had better tools and was able to quickly remove the plug. Whew, what a relief.

Both classes went well (of course, the students might feel differently, I suppose) - the PL/SQL community in Germany and the Netherlands is wide and deep: lots of very experienced developers attended. So I learned a few things along the way, which will soon make themselves known in PL/SQL Challenge quizzes. 

I also made an interesting discovery about how students concentrate on and extra information from the hundreds of slides and hours of talking I give them to them in a two day class. I covered FORALL in the class, also its SAVE EXCEPTIONS clause. I showed slides, ran code and talked about how if at least one statement raises an error, Oracle will save the exception information and then raise the ORA-24381 error. I talked about how you should avoid writing an exception handler like:


WHEN OTHERS THEN IF SQLCODE = -24381

and instead you should declare your own exception and assign it to this error, so 
you can write an exception handler like:


WHEN my_errors.forall_failure 

Then right at the end of the course, I talked about avoiding the hard-coding of error numbers and showed -24381 again as an example.

In the AMIS class, we ended with a short quiz. Two players tied for highest score (they selected 19 of 21 choices correctly across 5 questions - quite good!). So it was necessary for these two hotshots to engage in a sudden-death tiebreaker. The way I do this is I show a slide with a question and the first person to answer correctly wins.

The first slide asked: "Which feature of PL/SQL does this number relate to?" And then I showed "-24381". I thought there would be an instant response, given how often I showed and mention this number in the class.

And I was shocked to discover that neither of the students recognized the error code. I stared at them, surprised. Really? When I talked about it, referenced it multiple times, in the last two days?

Well, OK. We went on through several questions without success and then Christian Rokitta identified correctly that the optimizing compiler was first introduced in Oracle Database 10g. So congratulations to Christian for his first place showing, and to Danny Ven for the other score of 19 and his second place.

I am not exactly sure what to conclude from the inability to recognize the -24381 code. Perhaps students in my courses are confronted with so much information that they automatically filter out low level details. That way, they will be able to concentrate on the bigger picture.Certainly, people usually do not complain about how little I cover in my classes or how slowly I go through the material. And right at the beginning, I tell them to focus on principles and concepts, don't worry about all the technical details.

So I guess they took my advice!

In any case, now it is 4 AM on Sunday and I am (a) back in Chicago (hurray!) and (b) awake due to jet lag and (c) still without a voice.

Comments

  1. thanks from Germany for a great time! just something interesting a colleague and I came across in a discussion right after our amis class when googling some of the quiz answers: a compiler written IN PLSQL FOR PLSQL called TalkingPL. just an educational experiment, but quite mindbending nonetheless as it can compile itself... Josef

    ReplyDelete

Post a Comment

Popular posts from this blog

Running out of PGA memory with MULTISET ops? Watch out for DISTINCT!

A PL/SQL team inside Oracle made excellent use of nested tables and MULTISET operators in SQL, blending data in tables with procedurally-generated datasets (nested tables).  All was going well when they hit the dreaded: ORA-04030: out of process memory when trying to allocate 2032 bytes  They asked for my help.  The error occurred on this SELECT: SELECT  *    FROM header_tab trx    WHERE (generated_ntab1 SUBMULTISET OF trx.column_ntab)       AND ((trx.column_ntab MULTISET             EXCEPT DISTINCT generated_ntab2) IS EMPTY) The problem is clearly related to the use of those nested tables. Now, there was clearly sufficient PGA for the nested tables themselves. So the problem was in executing the MULTISET-related functionality. We talked for a bit about dropping the use of nested tables and instead doing everything in SQL, to avoid the PGA error. That would, however require lots of work, revamping algorithms, ensuring correctness, you know the score. Then my eyes snagge

How to Pick the Limit for BULK COLLECT

This question rolled into my In Box today: In the case of using the LIMIT clause of BULK COLLECT, how do we decide what value to use for the limit? First I give the quick answer, then I provide support for that answer Quick Answer Start with 100. That's the default (and only) setting for cursor FOR loop optimizations. It offers a sweet spot of improved performance over row-by-row and not-too-much PGA memory consumption. Test to see if that's fast enough (likely will be for many cases). If not, try higher values until you reach the performance level you need - and you are not consuming too much PGA memory.  Don't hard-code the limit value: make it a parameter to your subprogram or a constant in a package specification. Don't put anything in the collection you don't need. [from Giulio Dottorini] Remember: each session that runs this code will use that amount of memory. Background When you use BULK COLLECT, you retrieve more than row with each fetch,

Quick Guide to User-Defined Types in Oracle PL/SQL

A Twitter follower recently asked for more information on user-defined types in the PL/SQL language, and I figured the best way to answer is to offer up this blog post. PL/SQL is a strongly-typed language . Before you can work with a variable or constant, it must be declared with a type (yes, PL/SQL also supports lots of implicit conversions from one type to another, but still, everything must be declared with a type). PL/SQL offers a wide array of pre-defined data types , both in the language natively (such as VARCHAR2, PLS_INTEGER, BOOLEAN, etc.) and in a variety of supplied packages (e.g., the NUMBER_TABLE collection type in the DBMS_SQL package). Data types in PL/SQL can be scalars, such as strings and numbers, or composite (consisting of one or more scalars), such as record types, collection types and object types. You can't really declare your own "user-defined" scalars, though you can define subtypes  from those scalars, which can be very helpful from the p