Wednesday, March 30, 2011

Describing and Fetching/Copying/Manipulating any REF CURSOR

Ever needed to describe, fetch, copy or manipulate a REF CURSOR in Oracle, where you don't know the structure of the REF CURSOR in advance? My friend, Oracle test coach and PL/SQL expert, Finn Ellebaek Nielsen has spent a whole lot of time developing utility code implemented in a combination of PL/SQL, Java and C, that you can use as is in order to:
  • Describe any REF CURSOR: Get an XML document containing a description of the cursor's columns, including name, datatype, precision, scale and declaration code for a variable usable with this column.
  • Fetch any REF CURSOR to memory: Fetch the rows of the cursor into an ANYDATA instance. Optionally manipulate data for each row after it has been fetched through custom PL/SQL code.
  • Copy any REF CURSOR: Fetch the rows of the cursor and copy these to either memory or a table and get a new REF CURSOR opened for this copy. Optionally manipulate data for each row after it has been fetched through custom PL/SQL code. Optionally call custom PL/SQL code either before the new REF CURSOR is opened or after.
The utility code works with any weak and strong REF CURSOR and also any CURSOR expression (fetch/copy/manipulate doesn't support LONG and LONG RAW columns). It's supported with any edition of Oracle Database 10g Release 1 and newer and Finn also describes how you can make it work for Oracle Database 9i Release 2. Lastly, Finn discovered that contrary to Oracle’s documentation it’s possible to pass a REF CURSOR directly to a C external procedure.

Read all about it on Finn's blog here:

Cheers, Steven

Saturday, March 12, 2011

Fast moving football players

My nephew, Brian, is a big and fast football player. Well, he played football in college and is now in training for a pro day (NFL and other league coaches gather to watch players go through their paces) at the end of March.

He told me that at the training center he is using, they have special treadmills that can go up to 26 miles per hour (and support lots and lots of weight).

At the start of his training session, they had him do 8 second, 14 MPH sprints. We talked just the other day and he told that he had just managed to finish a 6 second sprint at 21 MPH.

Twenty-one miles per hour....and we are not talking about a lean, stringy human here. We are talking about over 250 pounds of muscle and bone, moving in a highly coordinated fashion; every motion, every muscle use has go to be optimized....

That is amazing. Go, Brian, go!

Sunday, March 06, 2011

Surprise! New goal set for self improvement...

A few days ago, I discovered somewhat to my surprise that I had set a new goal for myself: improve my flexibility so that I could touch my forehead to my knee in what is known in Yoga circles as Jansirsasan:

Why was this a surprise, you might ask.Well, a few months ago, a friend who is an avid Yoga disciple and teacher was going through a divorce. She commented that she believed that there is a link between physical and mental flexiblity. That if a guy couldn't touch his toes, he was probably also (mentally and spirtually) a rigid, inflexible person.

You will probably not be surprised to hear that her ex-husband was very inflexible in every aspect (according to my friend, of course). I promptly showed her (and my wife) that I could, in fact, touch my toes.

So I was very glad of that. The reason, though, that I could touch my toes is that I had already been focusing my stretches on improving my flexibility, mostly because it made my back and legs feel better.

When you get right down to it, though, touching one's toes doesn't really make you all that flexible. So I continued to work on my hamstring and leg stretches. And then when I was talking to my wife about my stretching and how I was getting closer and closer to lowering my head all the way to my knees, I realized that in fact I had set a goal for myself of doing just that - and I hadn't even known it! Ah, strange brain....

So now at least twice a day, I tear myself away from my desk, lie down on my mat, do a bunch of abdominals and then focus on my stretches. I am currently about 3 inches away from my knees.

And I have two weeks to close the gap, because that's when I will see my friend again. And I want very much to show her that I can do Jansirsasan (even if I can't necessarily do much of anything else very well in Yoga).

If you are, like me, a programmer who spends hours and hours in front of a computer, I strongly urge you to get into a daily regimen of abdominal exercises and stretching (yoga or otherwise). You will have far fewer problems with your back and hips; your legs will not ache from lack of mobility and tightness.

And you will, as a consequence, write better and happier code.