Sunday, June 25, 2006

Report from ODTUG, Washington DC 2006

ODTUG 2006 was held in Washington, DC, this year and it was, as usual, a great conference, even if I didn't win any awards. Ah, well, maybe next year....I had a treat on arrival to the Washington National airport (I'd really rather not use the newer, more distasteful name of the airport). Coming out of the gate area I faced a small gift shop that showcased "Three more years" t-shirts and paraphenalia. I found it very refreshing that one of the main gateways into the capitol would offer for sale such blatantly and mockingly anti-Bush stuff. Ah, the wonders of capitalism! If they buy it, we will sell it.

Well, back to ODTUG. I was very fortunate that my wife, Veva, came with me. As a result, I stayed longer and was in a better mood than usual. See, when I go to conferences, I mostly just want to go back home as soon as possible, to be with my family and get back to my comfort zone of programming and writing. With Veva around, however, I actually attended some of the social events!

Here are some PL/SQL-related ODTUG highlights:

1. Quest announced that it had acquired my two tools, Qnxo and Qute. We are now working hard to prepare Qute, a revolutionary unit testing tool for PL/SQL developers, for general availability at Oracle Open World 2006 (October 2006). You can download, try and give feedback on Qute by visiting www.unit-test.com.

2. The ODTUG board of directors announced on Monday that it would henceforth be sponsoring and organizing an annual PL/SQL training conference, chaired by, well, me. I held the first PL/SQL conference, Oracle PL/SQL Programming 2005, last November. Attendees enjoyed it greatly and immediately clamored for another in 2006. We are not yet sure of the date and location for this event, but I am very pleased to be working closely with ODTUG for future PL/SQL events. More news to come.

3. Lots of well-attended PL/SQL sessions. As Lucas Jellema of AMIS mentioned at the start of his Wednesday presentation, he has discovered the secret to a successful ODTUG session: put "PL/SQL" in the title. Not only were there a goodly number of PL/SQL presentations, but there were some new and very interesting ones, including: "PL/SQL for Dummies" by Paul Dorsey and Michael Rosenblum, authors of a new book by the same name; "Design Patterns in PL/SQL: Pre-inventing the Wheel" by Lucas, a fascinating look at how we in the PL/SQL world can leverage the concept and power of design patterns in our work; . Oh, and I gave two talks, one on "SQL games we can play in PL/SQL" and "Six simple steps to unit testing happiness"— I think they went well. I guess I will find out when I see the evaluations!

But as wonderful as all of the above happenings were, for me by far the absolute highlight of ODTUG 2006 was Bobert Dorsey. Bobert is 6 months old, the son of renowned author and teacher, Dr. Paul Dorsey, and his wife, Illeana Balcu. Bobert's real name is Robert, but he goes by Bobert (as well as "What a cute baby!"), he has wonderfully big round cheeks, and an incredibly friendly disposition. We got along famously.

As you well know, I enjoy PL/SQL greatly, but I would much rather hold, play with, and talk to babies any and every time. After all, who and what can be more important to humanity than its children? When I see a baby, I am totally shameless about asking his or her parent if I can hold him/her. Just ask Paul when you see him next. Thanks, Paul and Illeana, for being so generous and trusting!

For some additional commentary on the ODTUG show check out:

http://www.rittman.net/archives/2006/06/odtug_day_2_keynotes_bi_presen.html

http://technology.amis.nl/blog/?p=1233

And I strongly encourage you to read Lucas' (and other Amis consultants') recent writings on PL/SQL, which do a great job at getting us to think about different ways to use PL/SQL.

Tuesday, May 23, 2006

The sidewalks of Prague

From May 17-20, 2006, I visited the city of Prague, in the Czech Republic. It is a truly drazzling city with countless buildings of great beauty. I also found myself captivated, however, by the sidewalks of Prague. Click here to views the photos I took of a number of the sidewalks. I hope you enjoy them as much as I did.

I think the sidewalks caught my attention so dramatically because my views on ornamentation in architecture and public space generally have been changing. I used to be a "form follows function" kind of guy: I appreciated the clean lines of modern design and scorned elaborate designs that didn't seem to really do anything. If it isn't "doing" anything, then why waste time, effort and money building it?

Then I came across the writings of the architect Christopher Alexander. Alexander has developed a healthy dislike for modern architecture and believes that it is possible to come up with a "pattern language" that is universal and can help us design and build structures that improve our quality of life on multiple levels.

Alexander has in recent years published his "Nature of Order" series of books, which argue for the place of ornamentation in our architecture and other aspects of human creativity. I have come to agree and urge you to check out his writings, especially: The Timeless Way of Building and the Nature of Order series.

These sidewalks not only reflect a wonderful aesthetic, but also a very smart practicality. In Chicago and many/most US cities, the sidewalks are slabs of concrete. Very dull and in many ways not all that functional. With the extreme temperatures of Chicago, the concrete usually cracks shortly after it is laid in place. And in the many tree-shaded sidestreets of Chicago's numerous neighborhoods, roots cause the most delightful disruptions in the straight surfaces of the sidewalks.

Prague has similar problems with tree roots and wide fluctuations in temperature. Their "mosaic" sidewalks offer something of a solution. As temperature changes cause movement in the ground, the individual cubes will shift and sometimes pop out, but they are easily repaired, since the damage is much more localized.

Saturday, May 13, 2006

KUMU: the sparkling new Kunst (Art) Museum of Estonia

On Friday, I finished five days of straight training: talking for almost 6 hours each day, repeating the same seminar (and jokes....just hilarious!). I spent Saturday wandering around Tallinn, the capitol of Estonia. It is a beautiful city, with a large, incredibly well-preserved Old Town that is a UNESCO World Heritage Site.

I started the day by heading to KUMU, the sparkling new Kunst (Art) Museum of Estonia. It is a remarkable building with an excellent array of creativity. Whenever I visit a city for the first time, I always seek out the main art museum/gallery. I believe that one of the most human (that is, beyond mammalian) acts is to create, and art (a creation that is generally not tied to concrete purpose or objective, as compare to, say, an automobile or microwave machine) is the most direct expression of the mind (of course, functional objects often are works of art as well). I feel so fortunate to have been able to visit places like the Prado, London's National Gallery, Amsterdam's Rijksmuseum, and many more over the years.

The most striking of all the works I saw at KUMU was Ever is Over All by Pipilotti Rist. Here is a description of the work: "In Ever Is Over All, a young woman in a light blue dress merrily walks along the street with a huge, colorful, long-stemmed tropical flower in her hand. She smashes the flower into the windows of parked cars as she passes them."

That sort of captures a part of the work. At KUMU, it was projected onto two walls of a large room (each wall perhaps 25 feet in length). One wall shows the woman strolling down the street and occasionally and clearly with great exuberance smashing a car window. The other wall shows a field of the flowers the woman is holding (not that it could really be one of those flowers, as it pretty smoothly breaks through car glass). As and after she breaks a window, the woman is enraptured. A policewoman walks by at one point and salutes her. And rolling over all the action is very melodic, slightly haunting music.

I found it very exhilarating. I hope at some point it will be fully viewable from the web; do check out her website to see some of her other pieces. I took a fifteen second clip of the piece, but I don't want to post it without her permission.

OK, it is now 7:45 PM, and the sun is still very high in the sky. Time to venture forth once again from the Radisson and wander the Old Town.

Thursday, May 11, 2006

Letter from Scandinavia and the Baltics

I write to you from Tallinn, Estonia, Room 1818 of the Radisson SAS looking out over the Old City, as the sun sinks over the Baltic Sea. Very nice....

I am on a whirlwind sweep through Scandinavia, doing Best Practice PL/SQL seminars for Oracle Corporation in Copenhagen, Stockholm, Oslo, Riga and Tallinn (Estonia). Then I have two days off and head over to London to give a two day, "Best of PL/SQL" training, followed by two days in Prague (same seminar) – both also for Oracle. I stay an extra day in Prague to see at least a little of this city, and finally after a bit less than two weeks I head back to Chicago. It is the longest I will have been away from family and home for years, and I don't much like that....

Interest in PL/SQL in northern Europe remains strong; attendance at these seminars exceeds any I have done in these countries in recent years. In Copenhagen, Stockholm, Oslo and Riga, I presented to a combined audience 340 developers and DBAs!

I had a bit of a rough start, though. I boarded the 10 PM SAS flite to Copenhagen on Saturday night and expected to fall asleep immediately. After an hour or so, I realized that sleep wasn't coming because I was feeling sick. Turns out, I had caught a stomach flu. Not the most delightful way to travel 8 hours over the Atlantic. Well, two days and zero solid foods later, I am feeling fine, eating and exercising as usual. Whew. Glad that is put behind me.

I wasn't sure what telephone service back to the US from the former Soviet Union would be like, so I decided to finally sign up for Skype service. I bought myself a PC headset, and one for my somewhat technophobic wife, Veva. I installed the software on each of our computers and tested it before we left. It works great! I have since called her each night (her mid-day) through my laptop. Incredible technology. The sound quality is astounding, both computer to computer and using SkypeOut, which allows me to call her cell phone at a ridiculously low cost. And I just in the airBaltic magazine that Skype was developed largely by four Estonians. Perhaps I will run into them in Tallinn....

Another big step for me on this trip is that I finally broke down and bought an MP3 player. First, I tried the Sony Bean. I love its compact form, but its one-line screen (yes, that is not a typo. Just one visible line of text at a time) was beyond the capabilities of this middle-aged programmer. So I traded that for a Creative Zen Microphoto. 8GB capacity and a slide bar that I still have lots of trouble with, but is at least manageable. I loaded up some 50 CDs, added Shure e3c noise canceling headphones, and I was so ready to liven up by hours at the airport and on planes (I am, after all, traveling on nine different airplanes in 10 days) with my favorite music.

But then reality set in: I don't really like having anything stuffed into my ears or even covering them (those Bose noise cancelling headphones work very well, too, but they make my head ache). So I haven't been using my wonderful gadgets at all....I now plan to return them all when I get back to Chicago. Ah well....at least I have managed to load up my music collection on my computer. I find that I am perfectly satisfied to play my music through the relatively "tinny" speakers of my Thinkpad T42. Listening to Clapton's Unplugged right now.

By the way: for those who are not able to attend my lectures in Scandinavia, you can still download and check out the presentation by clicking here.

Thursday, April 13, 2006

Obsessive, compulsive me

I have little doubt that I "suffer" from a mild case of OCD (obsessive compulsive disorder). What other explanation is there for the TEN BOOKS I have published on the Oracle PL/SQL language?

[ Note: I put "suffer" in quotes because pretty clearly I haven't actually suffered, in fact, I have benefited from my obsession. I also use quotes because I generally find objectionable the tendency of medical professionals to give names to behaviors and medical conditions they don't necessarily really understand or are outside the norm. ]

And then there is my attitude towards GUIDs. I talked about these "Globally Unique Indentifiers" earlier in my blog. A GUID is a long sequence of characters that are supposed to be globally unique -- that is, the likelihood of a particular sequence of characters appearing (returned by the GUID generating function) more than once on any computer running on our globe is miniscule. Thus, you can use GUIDs when you need unique values that span, say, database instances or multiple networks.

I just ran into the need to generate about a dozen GUIDs for new assertions I have defined in Qute, the Quick Unit Test Engine. Unfortunately, I forgot to enable output to the screen for my block of code, so I could not use those GUIDs.

And I found myself feeling sad, a sense of loss. I found myself thinking: I just wasted those GUIDs. They will never reappear (as I would ever know!), they are gone forever.

Worrying about "losing" or "wasting" GUIDs? Now, that's surely a bit obsessive!

Time to enable output, run my script again, grab those GUIDs, and get on with my life!

Friday, April 07, 2006

Soduku and PL/SQL

In my continuing series of "Isn't it amazing what you can do with PL/SQL?" I offer below an email I received from a very clever fellow named, Phillip Lambert:
Hello Steven,

I'm not sure how much Sudoku puzzles have caught on in the US, but they are fairly big in the UK, particularly in all of the daily papers. Well I've probably been using PL/SQL much too long or probably am well due for retirement out of computers, but I was presented with a challenge the other day which some might consider quite sad. I wrote a Sudoku puzzle solver in SQL and PL/SQL which solves most puzzles presented to it.

The proud thing about it is that a colleague of mine who gave me the idea wasn't able to get his MS Excel VBA solution to work properly. Another colleague also took up the challenge, and again could not get his Java solution to fully work and has spent weeks compared to my days programming it. I'm not sure whether this is saying something for SQL and PL/SQL, but in any event I thought you might be interested. This could be a great opportunity to see whether anyone can use an alternative language to write a solution in less lines of code than a PL/SQL solution - now that would be a challenge!!
To check out Phillip's implementation of a Sudoku puzzler, click here.

Thursday, April 06, 2006

PL/SQL + PDF = PL/PDF - PDF docs from PL/SQL programs!

I am, as most who read my books and my blog must know, quite obsessed with the Oracle PL/SQL langauge. So I am always on the lookout for new and amazing things peoplea re doing with PL/SQL. I recently came across...

PL/PDF - http://plpdf.com

"Generate dynamic PDF documents from data stored in Oracle databases using the PL/PDF program package. PL/PDF is written exclusively in PL/SQL. It is able to either store the generated PDF document in the database or provide the results directly to a browser using MOD_PLSQL. No third-party software is needed; PL/PDF only uses tools provided by the installation package of an Oracle Database (PL/SQL, MOD_PLSQL). Use PL/PDF to quickly and easily develop applications with dynamic content but also quality presentation and printing capabilities."

Sounds like fun! I have only played around with PL/PDF a little bit, but it looks like they have put together a very nice, clean API to the underlying functionality, making it extremely easy to use PL/PDF. To give you a sense of that, check out the explanation of their approach.

You can trial PL/PDF by downloading the software and specifying 'TRIAL' word as the certification key. Limitations: max. 5 pages, watermarked pages.

My compliments and best wishes to Laszlo Lokodi and others at PL/PDF for showing how useful and flexible PL/SQL can be!

Tuesday, March 14, 2006

Some gotchas with Oracle XE

Oracle recently announced production/general availability of Oracle Express Edition (XE). Generally a very exciting development: a totally free, almost fully-functioned version of Oracle Database 10g that downloads and installs in minutes (well, assuming you've got broadband!).

I ran into a couple of glitches, however, that I thought I would share:

1. UTL_FILE is not available. Usually, when you install Oracle, the UTL_FILE package (used to read/write files within PL/SQL) is installed, EXECUTE is granted to PUBLIC, and a public synonym is created. With XE, the package is installed and the synonym created, but the GRANT EXECUTE has not been run.

To fix this problem, connect to a SYSDBA account and run the $ORACLE_HOME/RDBMS/Admin/utlfile.sql file, or simply execute this command (from a SYSDBA account):

GRANT EXECUTE on SYS.UTL_FILE TO PUBLIC
/

2. Oracle XE does not include a Java Runtime Environment. I have been using some Java classes, installed in the database, in my unit testing product, Qute. Here is an example of a call to this Java code:

PROCEDURE parse_package (
owner IN VARCHAR2
, package_name IN VARCHAR2
, program_name IN VARCHAR2
)
AS
LANGUAGE JAVA
name 'quPlSqlHdrParser.parsePackage(
java.lang.String, java.lang.String, java.lang.String)';


In pre-production versions of Oracle XE, the code compiled, but then raised runtime errors, sometimes ORA-00600, which are not trap-able with an exception section.

The production version still does not include a JRE and even worse, if you install the Oracle Database 10g Express Edition (Western European; " Oracle Database 10g Express (Western European) Edition - Single-byte LATIN1 database for Western European language storage, with the Database Homepage user interface in English only.") then the above code will not even compile. Very strange. Oracle seems to actually be looking at the literal string and attempting to validate it at compile time.

Yet if I install the
Oracle Database 10g Express Edition (Universal; Multi-byte Unicode database for all language deployment, with the Database Homepage user interface available in the following languages: Brazilian Portuguese, Chinese (Simplified and Traditional), English, French, German, Italian, Japanese, Korean and Spanish), then I do not get a compilation error.







Sunday, March 05, 2006

Ah, the good old days of high mileage vehicles....

I must admit, I am something of a Honda bigot. Maybe that's because back in 1971, in my second year of college in Rochseter, NY, my father gave me his bright orange Honda Civic. It was a tiny little bug car, light and durable, but certainly nothing fancy. I loved it! (my father is a big fellow, just over 6 feet tall and heavyset, so it is surprising to think that back then he would shift from his usual big sedans to a Civic, but that's the way he was/is - ready to try new things)

I now own a Honda Insight, the two-seater hybrid they released in 2000. Got mine in April 2000 and since then have averaged 49.8 MPG for some 46,000 miles. I love that car, too.

Got up this morning and somehow ended up going through the backroom in our basement, clearing out old stuff (and getting lungfuls of dust in the process) and came across a reminder of another Honda Civic I leased, and how far we haven't come in the last couple of decades.

Back in 1992, I left Oracle Corporation and become a consultant. Took a job working at McDonald's headquarters in Oak Brook -- and suddenly I was a commuter. So I looked around at my options and found the Civic VX. The VX was a Civic coupe with a VTEC engine adapted from the early Acura Integra.

It cost $10,550, which was considered fairly pricy for a little car back then, and boasted the following mileage:

Highway MPG: 55
City MPG: 48

Of course, I didn't hit those numbers, just like I only occasionally match the EPA MPG ratings for the Insight. But I clearly remember averaging MPGs in the 40s on the highway commutes I made to BurgerLand.

That was back in 1992-93!

So while I am glad to have my Insight (I really, really enjoy driving that car, even though its suspension is, shall we say, a bit brittle), I am also disappointed that the auto companies haven't come further in 14 years.

Sunday, February 26, 2006

PL/sql Experts Determined to Give their Expertise -- ???

I am distributing this idea out into the world of PL/SQL developers. Everything about it, including the name, acronym, structure, etc., is open to discussion. Please let me know what you think and if you would be interested in participating. Thanks!

PLEDGE -PL/sql Experts Determined to Give their Expertise

Let's face it: not all developers are equal. We have widely varied levels of skill, experience and communications abilities. Any such group of professionals has a tiny subset of members who are perceived as the "elders" (aka, gurus, experts, etc.) -- and age has little to do with this status. I feel strongly that those of us in the PL/SQL world who are deeply experienced should come together to make our contributions more visible and widely available to the worldwide PL/SQL community.

Disclosure: I am especially desirous of a group like this, and will benefit greatly from it, because I cannot possibly answer all the questions that come my way (either because my time is limited or the question involves how PL/SQL code interacts with technologies like XML or Java, about which I have little experience). I would like to formalize the group of people I can turn to, to assist me in such matters. But I certainly don't want to limit it just to helping me answer my questions.

What is PLEDGE?

PLEDGE is (would be) a group of highly experienced PL/SQL developers who are committed to sharing their knowledge and code with others, at no cost.

I bet you are already thinking one or more of the following:
  • Should PLEDGE be a part of IOUG?
  • Should PLEDGE be or is it the same as a PL/SQL SIG?
My feeling is that PLEDGE is different from a SIG. It is primarily/fundamentally a close-knit fellowship of experts, not an enormous membership community. It functions to provide high quality, free resources to the worldwide PL/SQL community.

As to whether it should be a part of IOUG, I don't have strong feelings about that right now. See my comments in the section titled Resources below. I am not sure that this would be consistent with an IOUG entity.

How would PLEDGE work?

Here are some initial thoughts/guidelines...

1. PLEDGE has members and guests.

2. A PLEDGE member is a PL/SQL expert who has agreed to contribute her or his time/effort to improve the skills, productivity and code quality of the worldwide PL/SQL community.

3. A PLEDGE guest is a developer who has registered with PLEDGE so as to take advantage of the resources offered by PLEDGE, participate in forums and so on.

4. There is no cost associated with any level of participation in PLEDGE.

5. A PLEDGE member or user can post a challenge/requirement to PLEDGE, and then a member can volunteer to implement/guide/answer that challenge.

6. All code that is posted on the PLEDGE website needs to be documented, tested and testable (preferably with a Qute harness; check out www.unit-test.com for my latest and greatest product/concept).

Resources needed

This community needs to be supported by commercial vendors who are committed to the Oracle space. I do not believe that we can make it work the way it should with only volunteer time contributed, though it is certainly a possibility....

I do believe that any number of vendors could provide a base of support, including Quest and Oracle.

Areas of expertise

We need general PL/SQL pros, but also people who have specialized in various areas of technology that commonly connect to PL/SQL, including but not limited to:

  • Java-PL/SQL interface
  • .Net-PL/SQL interface
  • VB-PL/SQL interface
  • Using XML in PL/SQL
  • Oracle Applications and PL/SQL
  • Object-Oriented development with PL/SQL
So let me know what you think of PLEDGE!

Monday, February 20, 2006

Gambling addictions

As casinos explode in number across the United States (how else can the most powerful nation in the world, spending over $500 billion on weapons and soldiers each year finance public education), it becomes more and more clear that an addiction to gambling has become a serious problem in the good old US of A.

An article in today's Chicago Tribune drives that point home, based on data gathered by the Center for Responsive Politics:

In 1990, the gambling industry "contributed" $478,000 to federal campaigns (that is, the "war chests" of individuals running for federal office, or more to the point, running to keep their position in Congress or control the Oval Office).

In 2004, that same industry forked over $13 million. Here are the top 5recipients from the 2004 election cycle:

1

Bush, George W (R)

Pres

$345,610

2

Reid, Harry (D-NV)

Senate

$309,713

3

Porter, Jon (R-NV)

House

$243,968

4

Berkley, Shelley (D-NV)

House

$199,441

5

Daschle, Tom (D-SD)

Senate

$193,900


So who is addicted to gambling? I would venture to guess that our elected officials (I hestiate to call them our representatives, because it seems to me that they more closely represent corporate interests and CEOs, not the rest of us) fit the bill very nicely.

Sunday, February 19, 2006

Watch out for sequential Oracle GUIDs!

I ran into a very interesting situation regarding Oracle GUIDs or Globally Unique Indentifiers, the other day. I will tell you about my experience and then after that, you can read all about Oracle GUIDs in an article I originally had published in Oracle Professional. Enjoy!

A GUID is a long sequence of characters that are supposed to be globally unique -- that is, the likelihood of a particular sequence of characters appearing (returned by the GUID generating function) more than once on any computer running on our globe is miniscule. Thus, you can use GUIDs when you need unique values that span, say, database instances or multiple networks.

My latest obsession is a product named Qute - the Quick Unit Test Engine. You can find out more about it at www.unit-test.com. We use GUIDs for primary keys; this makes our work substantially easier since the product and underlying data are installed on a user's computer, and we do not have to worry about possible conflicts with sequence-generated primary key values.

The Delphi frontend in Qute also takes those GUIDs and hashes their values to integers, which are then used to index arrays of data and speed up access to browser data. All fine so far.

Unfortunately, a number of users reported an error involving a "Hash Mismatch" on starting up of Qute. After lots of patient cooperation from those users, we were amazed to find that the Oracle SYS_GUID function (the GUID generator offered by Oracle) was returning sequentially-incremented values, rather than pseudo-random combinations of characters.

We then had a bug in our Delphi code such that the hashing algorithm was set to "quick and not very secure" -- meaning that strings which were not very different were hashing to the same number, which then triggered our error. We adjusted that algorithm, making it more robust, and the problem seems to have disappeared. But I thought I should let the world know about our experience.

To see if you have this issue in your installation of Oracle, run the following script:

SET SERVEROUTPUT ON
BEGIN
FOR indx IN 1 .. 5
LOOP
DBMS_OUTPUT.put_line ( SYS_GUID );
END LOOP;
END;
/

You should see five rows of wildly different values, like this:

E9DF272C0D284B338E27455430022D67
B513F57A646E4136AB220BAE52A0F6E8
A95CBEE73C404E52A28608FFFFE209DA
6F28A3D06E7143868E8E4AF92F43A085
4095D2129505456A9F6B2C001F06EDF7


But some Qute users on AIX and Compaq 64bit operating systems were instead seeing results like this:

0CC2D8AF5A0A6C9FE044080020C482B7
0CC2D8AF5A0B6C9FE044080020C482B7
0CC2D8AF5A0C6C9FE044080020C482B7
0CC2D8AF5A0D6C9FE044080020C482B7
0CC2D8AF5A0E6C9FE044080020C482B7


See the difference? The algorithm that Oracle is using on these operating systems is clearly faulty; yes, the values are unique but they are far from even pseudo-random.

The moral of the story is: if you are going to rely on the Oracle SYS_GUID function to generate GUID values, test the algorithm and make sure you are satisfied and can live with the results.

Going Global with GUIDs

Steven Feuerstein, Copyright 2005

Originally published in Oracle Professional, Ragan Communications

What is a GUID?

You've probably heard about and even seen some funky-looking string that is referred to as a "GUID". This article explains what a GUID is, how they can be very useful, and how you can work with them inside Oracle.

Let's start with a formal definition of a GUID, taken from Wikipedia (http://en.wikipedia.org/wiki/GUID):

"A Globally Unique Identifier or GUID is a pseudo-random number used in software applications. Each generated GUID is "mathematically guaranteed" to be unique. This is based on the simple principal that the total number of unique keys (264 or 1.8446744073709551616 \times 10^{19}) is so large that the possibility of the same number being generated twice is virtually zero. The GUID is an implementation by Microsoft of a standard called Universally Unique Identifier or UUID, specified by the Open Software Foundation (OSF)."

Ah! So a GUID is actually the Microsoft version of the UUID, about which Wikipedia tells us:

"A Universally Unique Identifier is an identifier standard used in software construction, standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE). The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. Thus, anyone can create a UUID and use it to identify something with reasonable confidence that that identifier will never be unintentionally used by anyone for anything else. Information labelled with UUIDs can therefore be later combined into a single database without need to resolve name conflicts. The most widespread use of this standard is in Microsoft's Globally Unique Identifiers (GUIDs) which implement this standard.

"A UUID is essentially a 16-byte number and in its canonical form a UUID may look like this:

550E8400-E29B-11D4-A716-446655440000"

So, in point of fact and strictly speaking, a GUID is a special (Microsoft-specific) case of a UUID. Perhaps because "GUID" is easier and more fun to pronounce than "UUID," it is the most common of the two terms, even when used in a non-Microsoft context (as we find in Oracle and as I will be doing in this article). I will continue, therefore, to refer to this number as a GUID.

One comment regarding the "mathematical guarantee" mentioned above: as far as I understand, no one has come up with an algorithm that really does quarantee a unique GUID. It is possible, though very, very improbable, that you could generate a GUID that conflicts with an existing value.

GUIDs are GOOD for...

The core value of a GUID is expressed in a single line of the UUID definition above, namely: "The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination." This statement should get Oracle database programmers thinking about two things:

  • Distributed databases: they are certainly a kind of "distributed system." So GUIDs should help us identify unique objects not just in a single instance but across different database instances.
  • Primary keys and unique indexes: we use these constraints to "uniquely identify" rows of information within a given relational table. Perhaps a GUID could be used for these situations?

If I am writing code for an application that resides in a single database instance, then GUIDs are probably not very compelling. Suppose I face a different scenario: my application runs on many different instances. Each instance has its own users inserting their own data. On a regular basis, however, data from one instance must be merged into another instance.

In this scenario, reliance on sequence-generated primary keys gives me serious heartburn. Since users are inserting rows independently in multiple instances, sequence values are being used up at different rates. When I move data from one instance to another, I have to assume and program for primary key conflicts of various kinds.

This is exactly the situation I encountered as I built Qnxo (www.qnxo.com). This product provides access to a large and ever growing/changing set of PL/SQL scripts (reusable code and generation templates). Any changes to my central PL/SQL repository must be distributed to users. In my first phase of design and construction of Qnxo, I relied on sequence-generated primary keys. As soon as I realized the error of my ways, I converted as much as possible over to GUIDs.

Let's take a closer look at some of the lessons I learned about applying GUIDs in the PL/SQL environment.

Oracle and GUIDs

To help us work with GUIDs, Oracle provides a SQL function named SYS_GUID, documented as follows:

"SYS_GUID generates and returns a globally unique identifier (RAW value) made up of 16 bytes. On most platforms the generated identifier consists of a host identifier, a process or thread identifier of the process or thread invoking the function, and a non-repeating value (sequence of bytes) for that process or thread."

The difference between a RAW and a VARCHAR2 is that RAW string is not explicitly converted to different character sets when moved between systems by Oracle. This point is critical for GUIDs, since we wouldn't want our GUIDs to be changed as they move from one system to another. Conversely, it is also a non-issue for GUIDS, because the characters used in GUIDs are drawn from a restricted subset of ASCII characters, which are static across all character sets.

This function is also exposed in PL/SQL through the STANDARD package as follows:

CREATE OR REPLACE PACKAGE BODY STANDARD
AS

...

FUNCTION SYS_GUID
RETURN RAW
IS
c RAW (16);
BEGIN
SELECT SYS_GUID ()
INTO c
FROM SYS.DUAL;

RETURN c;
END;
END STANDARD;

I can therefore immediately obtain a GUID from within my PL/SQL program by writing code like this:

DECLARE

l_guid_raw RAW (16);

l_guid_vc2 VARCHAR2 (32);

BEGIN

DBMS_OUTPUT.put_line (SYS_GUID);

l_guid_raw := SYS_GUID;

l_guid_vc2 := SYS_GUID;

DBMS_OUTPUT.put_line (l_guid_raw);

DBMS_OUTPUT.put_line (LENGTH (l_guid_raw));

DBMS_OUTPUT.put_line (l_guid_vc2);

DBMS_OUTPUT.put_line (LENGTH (l_guid_vc2));

END;

/

And here is the output from running this code:

E7D3F9F0A0B24390AA504E79EC132677

6FB0B56BA65C4B1580827575F0DDB602

32

693295E9405D4C7C8B3453E481EF4DA5

32

Formatting for GUIDs

As Wikipedia specified earlier in this article, ""a UUID is essentially a 16-byte number and in its canonical form a UUID may look like this: 550E8400-E29B-11D4-A716-446655440000."

In addition, in many situations, the common presentation format for a GUID is:

{550E8400-E29B-11D4-A716-446655440000}

So as you decide to incorporate GUIDs in your code and underlying database, you should decide how you want to store the GUIDs. You could stick with the unvarnished RAW values, or you could store a formatted version, if that is how the GUIDs are going to be used in your application.

We decided that in the Qnxo, we decided that the GUIDs would be stored with the full formatting, including dashes and the open and close brackets.

Using GUIDs in Oracle tables

Let's look at how we can use GUIDs inside a relational table.

Below I create a table using a GUID as the primary key for a table.

CREATE TABLE guid_table (

pky RAW(16) PRIMARY KEY

, NAME VARCHAR2(100));

When I insert a row into this table, I can use the SYS_GUID function to generate my unique GUID. I try to do it this way:

INSERT INTO guid_table

VALUES (SYS_GUID, 'Steven');

but I get the following error:

ORA-00984: column not allowed here

As with .nextval, I am unable to call this function directly in SQL. So if I want to insert rows I need to write and run code like this:

DECLARE

l_pky guid_table.pky%TYPE;

BEGIN

l_pky := SYS_GUID;

INSERT INTO guid_table

VALUES (l_pky, 'Steven');

l_pky := SYS_GUID;

INSERT INTO guid_table

VALUES (l_pky, 'Sandra');

END;

/

Now I can select the data from this table:

SQL> SELECT * FROM guid_table;

PKY NAME

-------------------------------- ---------------

DF832F19657645A2866E7AD15E9F59AF Steven

5FBAB1A92157434EBDBDB5880556D151 Sandra

That's certainly easy enough! Of course, since we want to make certain that a valid GUID is placed is in this column, it would be best to encode that logic into a BEFORE INSERT trigger on this table, as in:

CREATE OR REPLACE TRIGGER guid_table_bi

BEFORE INSERT

ON guid_table

FOR EACH ROW

BEGIN

IF :NEW.pky IS NULL

THEN

:NEW.pky := SYS_GUID;

END IF;

END;

/

And I can now insert into this table as simply as this:

INSERT INTO guid_table

(NAME

)

VALUES ('Joe'

);

In the case of Qnxo, since we decided to store the formatted version of the GUID, we created tables with primary keys defined as follows:

CREATE TABLE sg_favorite (

universal_id VARCHAR2(38) PRIMARY KEY

...

);

Encapsulating Oracle's GUID function

If you decide that you want to work with Oracle GUIDs in the RAW format and never need to deal with the formatted version, then you are pretty much ready to go. If, on the other hand, you want to able to work with GUIDs in a "standard" format, you may want to take advantage of the guid_pkg I wrote to assist in Qnxo development.

The elements in the package are:

guid_t

A SUBTYPE that encapsulates the RAW(16) declaration of a GUID and gives it a name. With this subtype in place, you can declare GUIDs in your code as follows:

DECLARE
my_guid guid_pkg.guid_t;

formatted_guid_t

Another SUBTYPE, this time designed to allow you to easily and readably declare variables that hold a formatted GUID, used as follows:

DECLARE
my_guid_with_brackets guid_pkg.formatted_guid_t;

c_mask

A mask that specifies the valid format for a formatted GUID. It also serves as a wildcarded string that I can use within a LIKE statement to determine if a string matches the standard GUID format.

is_formatted_guid

A Boolean function that returns TRUE if the string passed to it has a format consistent with the standard GUID format.

formatted_guid (2)

Two overloadings of functions that return a formatted GUID. In the first overloading, you pass a string, which could be a RAW GUID value or a VARCHAR2 string. It will return a string containing the GUID in the standard format (as specified by c_mask).

Here is a script that exercises this package:

DECLARE

l_oracle_guid guid_pkg.guid_t;

l_formatted_guid guid_pkg.formatted_guid_t;

PROCEDURE bpl (val IN BOOLEAN)

IS

BEGIN

IF val

THEN

DBMS_OUTPUT.put_line ('TRUE');

ELSIF NOT val

THEN

DBMS_OUTPUT.put_line ('FALSE');

ELSE

DBMS_OUTPUT.put_line ('NULL');

END IF;

END;

BEGIN

DBMS_OUTPUT.put_line (guid_pkg.formatted_guid);

bpl (guid_pkg.is_formatted_guid (guid_pkg.formatted_guid));

bpl (guid_pkg.is_formatted_guid (SYS_GUID));

bpl (guid_pkg.is_formatted_guid ('Steven'));

DBMS_OUTPUT.put_line (guid_pkg.formatted_guid (SYS_GUID));

DBMS_OUTPUT.put_line

(guid_pkg.formatted_guid ('B16079A0567148608C171FA89E7187B3')

);

END;

/

With this output after execution:

{B33204AD-ADDB-4CC6-87F2-2D0D13594F7C}

TRUE

FALSE

FALSE

{1F17C465-E58E-4F8B-AABA-9C1C712D992B}

{B16079A0-5671-4860-8C17-1FA89E7187B3}

Listing 1. The specification of the guid_pkg package

CREATE OR REPLACE PACKAGE guid_pkg

IS

SUBTYPE guid_t IS RAW (16);

SUBTYPE formatted_guid_t IS VARCHAR2 (38);

-- Example: {34DC3EA7-21E4-4C8A-BAA1-7C2F21911524}

c_mask CONSTANT formatted_guid_t

:= '{________-____-____-____-____________}';

FUNCTION is_formatted_guid (string_in IN VARCHAR2)

RETURN BOOLEAN;

FUNCTION formatted_guid (guid_in IN VARCHAR2)

RETURN formatted_guid_t;

FUNCTION formatted_guid

RETURN formatted_guid_t;

END guid_pkg;

/

The implementation of this package is shown in Listing 2. It relies on the SYS_GUID function to generate a new GUID value, but otherwise is devoted to applying the format mask and converting un-formatted GUIDs to strings that contain the correctly-placed hyphens.

Listing 2. The body of the guid_pkg package

CREATE OR REPLACE PACKAGE BODY guid_pkg

IS

FUNCTION is_formatted_guid (string_in IN VARCHAR2)

RETURN BOOLEAN

IS

BEGIN

RETURN string_in LIKE c_mask;

END is_formatted_guid;

FUNCTION formatted_guid (guid_in IN VARCHAR2)

RETURN formatted_guid_t

IS

BEGIN

-- If not already in the 8-4-4-4-rest format, then make it so.

IF is_formatted_guid (guid_in)

THEN

RETURN guid_in;

-- Is it only missing those squiggly brackets?

ELSIF is_formatted_guid ('{' || guid_in || '}')

THEN

RETURN formatted_guid ('{' || guid_in || '}');

ELSE

RETURN '{'

|| SUBSTR (guid_in, 1, 8)

|| '-'

|| SUBSTR (guid_in, 9, 4)

|| '-'

|| SUBSTR (guid_in, 13, 4)

|| '-'

|| SUBSTR (guid_in, 17, 4)

|| '-'

|| SUBSTR (guid_in, 21)

|| '}';

END IF;

END formatted_guid;

FUNCTION formatted_guid

RETURN formatted_guid_t

IS

BEGIN

RETURN formatted_guid (SYS_GUID);

END formatted_guid;

END guid_pkg;

/

GUIDs: a nice addition to the toolbox

I'd heard of GUIDs, but never had reason to work with them before developing Qnxo. I started with standard, sequence-generated primary keys in my script table, but found that this approach was sorely lacking when it came time to distribute that content (reusable scripts and templates) to my user base.

By relying on GUIDs, I was able to greatly simplify the logic needed to upgrade distributed content from a central source. Not only did I avoid the problem of conflicting sequence-generated primary keys, but I was also able to keep intact foreign key references, since they were based on unchanging GUIDs.

Saturday, February 11, 2006

Poorly tested software strikes again....

I am on occasion honored with a request to do a keynote presentation at Oracle User Group meetings. I could do the usual "top ten" this or that for PL/SQL, but that has always seemed a bit too narrow for a keynote (even if PL/SQL is just about the only reason anyone would want me to keynote). So I put together a presentation called "Software programmers: Heroes and Heroines of the 21st Century", which focuses on the incredibly central and important role we developers play (for better or worse!) in our society.

Generally, I ascribe to one of the core insights of Lawrence Lessig: code is a form of law, which means that in many ways, programmers are law-writers and certainly we are in the critical path of implementing laws (applications) that control human behavior through software.

So I am constantly on the lookout for stories that drive this point home -- and I ran into an excellent one this morning in the Chicago Tribune. I reproduce the article below. Summary:

A poorly designed and tested interface allows an unsupervised, untrained and unauthorized user to change a value in a field which ends up disrupting the budgets and plans for a school district and several towns.

So test your code, people! And to help you test your PL/SQL code, I am building a new tool named Qute, the Quick Test Engine. We are testing pre-production releases now and you are welcome to download and try it out. Qute makes unit testing dramatically, qualitatively, breath-takingly easier than you can even imagine!

A $400 MILLION HOUSE?
A computer error gave Indiana taxing bodies that false idea. They're out about $8 million.

By James Janega
Chicago Tribune
Tribune staff reporter
Published February 11, 2006

The story of the $400 million house began innocently enough--with a faulty computer entry.

This week, however, things went downhill fast, as school systems and towns throughout Porter County, Ind., scrambled to fill gaping budget holes resulting from a colossal goof in the tax valuation of a modest two-bedroom house in Valparaiso.

And on Friday, the owner of the wildly overvalued ranch was scratching his head, wondering if it's too late to sell.

"We'd sell it for 5 percent of that!" said Dennis Charnetzky, 32, who heard about the mistake that afternoon while working at his home remodeling business.

Pausing, he reconsidered: "At least I don't owe $8 million in taxes."

In October 2004, give or take, a real estate agent--or maybe a title company employee--checking on the value of the Valparaiso property on a county computer system apparently tapped the wrong key. Officials figure it was an accident.

The unidentified user stumbled onto a restricted screen, and then changed the value of the $120,000 house in the 1100 block of Chicago Street to $400 million.

Trying to reconstruct the event, officials imagine the user looking up and realizing something was amiss, then hitting "escape" to leave the screen. But the new value stayed in the computer, and the property tax bill for the house leaped from $1,500 to the upper seven figures.

"They never reported it to the county that they got a funny screen," Porter County Treasurer Jim Murphy said of the mystery typist.

The error was spotted at least twice, Murphy said. One woman in the county auditor's office spotted the problem the day after the entry when the county's equalized assessed value went sky high overnight.

The auditor's office fixed the glitch that allowed outsiders into the county tax computer system, but the $400 million valuation somehow remained.

Last May, the bank that held the home's escrow account, got a tax bill on the property for $8 million. The bank asked the county to take another look at things.

"We thought the problem had been fixed," Murphy said. "It had not been."

So, guided by its computers, the county expected to collect taxes on this startling new abundance, and other taxpayers were asked to pay a little less. Budgets were built around the phantom figures.

"And that's when the poop hit the fan," the treasurer said.

Eighteen taxing districts from the city of Valparaiso, the county and the Valparaiso schools now find themselves in the position of having to return to the county an advance of $3,090,287.33 that was never collected.

That's $1,700,192.51 from the Valparaiso Community Schools, which had counted on the money for their $38 million 2006 budget.

It's also $1,045,527.33 back from the city of Valparaiso (2006 budget: $21.3 million), which had been mounting an aggressive city beautification effort, complete with street resurfacing and sidewalk repairs.

"You can imagine the panic it caused here," said City Administrator Bill Hanna. "You won't find us buying laptops."

Still, no matter what anybody says, "We're not even thinking about laying people off," he said.

But that cracked sidewalk? Might have to wait until next year.

Officials say the county and its various taxing bodies will make it through the short term, as they negotiate with the state on how to correct the mistake. Long-term finances will depend on what's decided.

Back to the house.

"It's a nice home on a quiet street in Valparaiso," Murphy said. "Nice neighborhood, good schools."

The leafy street is just a half-mile from downtown restaurants, steps away from Parkview Elementary School, and walking distance from a lush, grassy park.

The 1,200-square-foot, two-bedroom, one-bath, single-story house (with basement) valued at $121,900 was built in 1949, according to Porter County tax records.

It seems to have little in common with other real estate in the $400 million range--for instance, the twisting 115-story, 2,000-foot Fordham Spire proposed last July for a site along Lake Shore Drive in Chicago. If built, that $400 million tower would be the tallest building in North America, with 250 condominium units and a 200-room luxury hotel.

Until 2004, the owner of the Valparaiso ranch home was Robert Affeld, who had lived there 20 years with his wife Sarah, now deceased.

"I never heard anything about it like that," said Affeld, who now lives with his daughter in Danville, Ind. "I sure ain't got $8 million to pay taxes, that's for sure."

He sold the house to Dennis' wife Daelyn Charnetzky, 31, a hair stylist. The Charnetzkys have lived there for more than a year, with no idea they had gotten such a bargain.

"I feel bad for the city for not getting all the property taxes they deserve," said Dennis Charnetzky, who did not sound like he felt bad at all. "It really blows my mind when you hear about stupid stuff like that happening."

On the other hand, Murphy said, one of the darkest weeks in Porter County financial history is over.

"There's a light at the end of the tunnel," he said. "At least it's Friday."

----------

jjanega@tribune.com

Friday, February 10, 2006

Recovering from a hands-on training

I gave a two-day, hands-on training on PL/SQL collection this week, organized by John Goodhue of Speak-Tech. It was a very enjoyable, interesting and eye-opening experience. [ Note: you can download, study and use (inside your company) all the materials for this course without charge by clicking here. ]

I have been doing lecture-style trainings for years, to audiences big and small, and they have become second nature to me. I put together a Powerpoint presentation of about 100 slides per day, and within those notes reference dozens of pre-defined scripts. I then strap on a wireless microphone and spend six hours talking too quickly, covering too much material, and running lots and lots of code demonstrating my points and PL/SQL's features.

Developers seem to love it. But they also complain about the pace and ask that I go more slowly and include hands-on exercises.

So John, who helps me organize these trainings in the US, asked me to put together a hands-on class. I decided to focus specifically on collections, since they are at the core of just about every interesting new feature in PL/SQL and they are very much under-utilized in the world of PL/SQL development.

So I took my lecture materials, reorganized them a bit, and built out an extensive set of exercises, which I implemented in Qnxo as a script repository. That was fun. Qnxo is a very flexible and handy tool. It focuses on code generation and code re-use, but it can be easily adapted to other purposes. The download referenced above contains a script that will install the course exercises into Qnxo if you have it installed.

Anyway....off I went to Minneapolis to teach the course for about 15 students. The feedback was very positive -- and perhaps predictable, as more than a third of those attending said that I tried to cover too much in two days that that it should be a three day class!

But it also showed me how differently I must teach and prepare materials for a hands-on class compared to lecture-style. The materials I provided (and these weaknesses are still reflected in the download) did not offer enough basic information about syntax of features. That was fine when the main objective was to demonstrate to attendees how stuff works. But it was not adequate when those training materials were supposed to provide a foundation from which the students would actually write their own code in class.

So the next time I give this class (visit Speak-Tech to find out about scheduling of this class in 2006), the Powerpoint will have twice as many slides. I will also more carefully construct the exercises so that students will concentrate their code writing on the collection-specific topics.

Sunday, January 29, 2006

Daniel Fischel: Corporate Kiss Ass

Just read a fascinating article in the Chicago Tribune (registration required to read it) about Daniel Fischel. Now before we go any further, I will admit to being jealous of this fellow. He's a professor, which is already pretty cool, but also serves as an expert witness at $1000 an hour for corporate cruds like Chalres Keating, Michael Milken and Jeffrey Skillin, and has collected tens of millions of dollars from his investments and countersuits.

Having said that, I am just glad that I have lived my life so that when a newspaper reports on me, they cannot offer this sort of reflection from a supposed admirer:

"He believes in what he says. He's a man of integrity in that sense."

Oh, yeah, that sense. The sense known as self-delusion. Hey, President Bush probably also believes in everything that he is doing. But not Cheney, no, no, I think he knows exactly who he is killing and the names of the people who are enriched as a result of those deaths. But W? Who knows? He might be just about as oblivious as Ronald Reagan, who would apparently fall asleep while meeting with other "leaders" of the G7.

The Trib also offers a sidebar of "Daniel Fischel on Michael Milken". Let's cut to the chase on this one with a quick summary:

1. At the time Milken pleaded guilty to six felonies, he said "What I did violated not only the law, but all my principles and values."

2. Fischel's response to a question ("You contend...Mr. Milken did nothing illegal?"): "That's right." Hey, just an honest difference of opinion, right?

3. Fischel received well over $20M as a result of his "professional" associations with Milken.

This is quite a guy!

Movie Idiocy: The Island

I watched The Island last night (warning: reading this blog might spoil the movie for you, so please do watch it first). It met my low expectations fairly well. Sci-fi flick with a big budget ($120M), cute stars, and derivative plot. And that (element of the plot) is the focus of my Movie Idiocy blog today.

[What is Movie Idiocy? I like to watch movies, but I also like to complain about stuff. So -- perfect combination -- I will complain about movies. In particular, I will from time to time point out elements of movies that I consider to be truly idiotic.]

Call me a whiner, but I am frequently dumbfounded by how a company can spend $100M and more on a movie budget but not seem to be able to find someone who can write a script that doesn't have gaping wide holes in it.

I don't mean that the movie might rely on an idea that is outlandish. Outlandish is fine, cool, perhaps even really interesting. I mean that a movie should start from certain (preferably few and simple) assumptions and then stick to them honestly. Put us in that world and play by the rules.

Sure, most movies have a hard time doing this -- primarily because their producers and directors don't really care. And by this I mean that they don't seem to have much respect for us, the watchers. Either they think we are stupid or they think that we don't care. We just want another does of eye candy to help us get through another two hours of existence.

Does that sound like you? Doesn't sound like me.

All right, well, here is an example from The Island: the heroine, Scarlet Johansen, is captured by the Bad Guys (private security firm, best in the world, really know their stuff, uh-huh) right near the end. They take her back to Silo 3 and prepare to harvest her organs (whoops, gave something away). She is lying on a surgical platform, covered by a sheet. The security goon gets all creepy on her and then steps away...and then....camera pans back, we see her full body, and she reaches under the sheet, down near her crotch...

And pulls out a gun! A gun she took from the home of her best friend clone's original! And she shoots the creep in the knee!

A gun? You mean Blackhawk Security (could they be slyly mocking Blackwater Security, which is sucking up our tax dollars like crazy in Iraq?), world renowned, top-flight former Seals, etc., didn't think to frisk her for weapons? And she could lie there on that platform, wearing what seems to be tight fitting clothes, covered by a sheet and no one notices the gun?

I can't even make a joke about being glad to see me. She's a woman!

So...that is totally idiotic. Now you might say: Steven, chill. The movie is pretty stupid all around. They spent $120 million to create a movie about cloning that is itself a clone of several other movies (the producers of one of which actually sued them for copyright infringement). Their product placement is so blatant and pervasive that it seems mostly like an advertisement for Microsoft (Xbox and MSN in particular).

Still, I go back to my original, core complaint: if your budget is going to be $100M or more, surely you could set aside enough money to find a decent author who could think through a plot so that it didn't contain holes that make us feel stupid for watching it. Hell, pay me just $500,000 and I will do it. Guaranteed. No logical gaps. No obvious stupidities.

Monday, January 23, 2006

So you want some PL/SQL content, eh?

Not surprisingly, many people visiting my blog wonder why I am not talking about PL/SQL.

Hey, it's a great language, and it's made my life a thing at which I marvel daily, but there's more to life than PL/SQL, and so far I am using this blog as an outlet primarily for non-PL/SQL thoughts -- though I expect as I settle into this thing more and more PL/SQL-related posts will appear.

Having said that, I do publish a monthly PL/SQL newsletter - OPP/News - and you can click here to sign up for the newsletter.

You can read previous editions of the newsletter by clicking here.

And here are some excerpts that you might find interesting...

December 2005

Tip of the Month: Insights into PL/SQL Integers

When it comes to declaring and manipulating integers, Oracle offers lots of options, including INTEGER, BINARY_INTEGER, PLS_INTEGER, POSITIVE, SIGN_TYPE...the question that immediately comes to my mind is: how much of a difference in performance does the choice of datatype make in my program? I put together a script to analyze precisely that: the integer_compare script set. It comes in two flavors: integer_compare.sql, which can used in Oracle Database 10g (relies on DBMS_UTILITY.GET_CPU_TIME to compute elapsed time) and integer_compare_pre_10g.sql, which can used in versions earlier than Oracle Database 10g (relies on DBMS_UTILITY.GET_TIME to compute elapsed time).

November 2005

Useful Code of the Month: Emulate primary key and unique indexes

The summer reading package shown above demonstrates a very powerful technique: emulation of primary key and unique indexes in collections, relying on string-based indexes for concatenated indexes and string values in the key or index definition. Unfortunately, you have to write a whole bunch of code to take advantage of this technique -- or do you?

Saturday, January 21, 2006

The wonders and frustrations of the Honda Insight

I bought a Honda Insight back in 2000, probably one of the first to drive this remarkable little hybrid car in Chicago. The dealer tried to get me to pay $5000 over list. Ha!

Over the last 5+ years and 45000+ miles (I avoid driving whenever possible), I have averaged 49.8 MPG. As good as the EPA ratings? Of course not, but I never expected that. I am really really happy with this peppy, aerodynamic, gas-stingy vehicle.

Unfortunately, there is one big, bad thing about the car: it is absolutely horrible when driving in snow. The car is so darned light that it just rides on the merest layer of snowflakes. It also rides, very very low to the ground. Great for gas mileage, but....

Last night, Veva and I drove up to Milwaukee for the opening of Chris's latest show: Public Display of Affection. I knew that snow would be falling, but we figured we could make it in the Insight (Chris already had our all-wheel drive Subaru wagon up in Milwaukee). So we spent almost four hours driving the usual 1.5 hour trip through heavy snow on unplowed highways. My hands, legs, neck were tied in knots. It was very rough going, but I kept my snowflake of a car on the road.

On the way back, they finally plowed the highways and all was well, until we got to a tollbooth. There, suddenly, the plowing on the left lanes stopped and I went headlong into snow that must have been 10-14 inches high. So what, you might ask?

So I spun to the left, almost turned all the way around. Got myself straightened out, and we went on, but it sounded like we were dragging big chunks of ice with us. Ugh. Finally got off at next exit and found that the hard plastic layer of something or other that protects the undercarriage from the road had come peeled away from the car and was both scraping and dragging.

How pathetic. How irritating. Especially since I'd finally gotten around to canceling the collision coverage on my car. How totally predictable.

So I make a vow to myself: do not drive the Insight in any sort of heavy snow.

Friday, January 20, 2006

What will I allow on my blog?

So I have finally dipped my toe into the vast sea of blogging, and it also immediately has raised very interesting questions for me.

I previously stated that I would not allow anonymous comments on my blog. A previously-anonymous commentator then signed himself or herself up with the name "Hater of Liberals" and posted a response, which I approved.

And I now find myself thinking that I am not going to allow any more posts from a person with a blogtag like "Hater of Liberals."

Yet when I ponder taking such an action, I then challenge myself with thoughts like this:
  • Am I afraid to hear views that are very different from my own, and very challenging?
  • Isn't that a form of censorship, which I generally abhor?
  • Why not let the, ahem, ideas flow freely, so that we can all learn from each other?
After thunking on it some more, I realize that my discomfort with "Hater of Liberals" comes down to this:

The world is full of brutal, hate-filled, and/or greedy people. They make the world a much uglier, harsher place. I can't stop them from existing, but I can keep them off my blog.

So...no haters on my blog. I will not accept comments from people with hateful tags. I will not publish comments that contain vile, spiteful, malicious comments.

So Hater of Liberals can now change his/her tag and then perhaps his/her comments will make it onto my blog. Maybe not.

My boys

I have two sons, Chris and Eli.

Chris is an artist with incredible depth and talent. I encourage you to visit www.chrissilva.com and experience his vision of the world and life. You will be richer in all ways but $$ as a result.

Eli is currently attending university and spending gobs of his time learning about and playing jazz guitar. I am beyond thrilled and amazed that I have a son who is an accomplished musician.

Check out a short music video of Eli's band, Ela, at the Middle Mind Project. Click on the "ela_cigarette song" link. That's Eli playing the guitar solos.

Ah, the joys of Daddyhood!