Thursday, February 21, 2008

Hah, they didn't even mention "bind variable"

But, we all know that is the true cause of the problem... The lack of use of bind variables - making special characters in names do nasty things like: (this is a quote)

... apostrophe is often mistaken for a piece of computer code, corrupting the system. ...

Ah, yes, the nasty apostrophe, capable of corrupting entire systems.

It is sloppy programming (they got that right).  Lack of binds is a co-winner of first place "bad things to do" right along side "when others then null".

I still wish....

  • when others would be removed from plsql
  • triggers would be deprecated and removed
  • autonomous transactions would start just raising errors
  • literals in sql would raise an error

All of those bullets are hyperbole, but they make a point.  When I see "when others" in code, it is more often used wrong (in the order of 1000 to 1).  When I see a trigger developed to "enforce integrity" - it is almost always wrong.  The way people use autonomous transactions - almost always WRONG.  Literals in SQL - usually wrong (but not always, but here I would err on the side of caution - outlaw literals and let bind peeking put them back in later...)

I know, I've said this before.

You know, I'll say it again.

Because I see the same four mistakes every day.  Every. Single. Day.  Especially the "when others" and lack of binds.  Followed by triggers.  Fortunately, most programmers never read to the autonomous transaction chapter...

Monday, February 11, 2008


Yet another blog - a friend of mine, Tyler Muth, has been blogging for a while.  He concentrates mostly things PL/SQL, APEX and developer related. 

Maybe I should get him to format my entries from time to time - his look really nice.  Hope you find it useful.

Wednesday, February 06, 2008

Why the command line rocks...

because when you own it, you own the world.  You can literally do anything you want (given you have that privilege of course)...

Check this out.  Neat eh.

Control the command line and nothing will ever control you.  You have to understand something before you can do that stuff.

Besides, ASCII art is universal... (ctl-f for "A standard confirm")


ops$tkyte%ORA10GR2> CREATE TABLE hash_example
2 ( hash_key_column date,
3 data varchar2(20)
4 )
5 PARTITION BY HASH (hash_key_column)
6 ( partition part_1 ,
7 partition part_2 ,
8 partition part_3 ,
9 partition part_4
10 )
11 /

Table created.

ops$tkyte%ORA10GR2> insert into hash_example
2 select sysdate+rownum, 'x'
3 from all_objects
4 where rownum <= 10000;

10000 rows created.

ops$tkyte%ORA10GR2> select pname, cnt,
2 substr( rpad('*',30*round( cnt/max(cnt)over(),2),'*'),1,30) hg
3 from
4 (
5 select uo.subobject_name pname, count(*) cnt
6 from user_objects uo, hash_example he
7 where uo.data_object_id = dbms_rowid.rowid_object(he.rowid)
8 group by uo.subobject_name
9 )
10 order by pname
11 /

------------------------------ ---------- ------------------------------
PART_1 2398 ***************************
PART_2 2466 ****************************
PART_3 2563 ******************************
PART_4 2573 ******************************

Tuesday, February 05, 2008

The word pathetic never sounded so good...

A while ago, a friend - Alberto Dell'Era - sent me a link to some youtube videos.

Videos on SQL.

It is SQL worst practices - presented in 20 minutes by Stephane Faroult.  To hear "pathetic performance" with the accent just made me laugh.

Note to all developers:

watch these - they are good, they are correct (they are ironic, anti-patterns, don't do them - do the opposite). 

Some people have said they could not see the embedded videos (probably using a news aggregator/reader - not the source entry itself).  Here are the links, embedded videos follow:

Part 1:
Part 2:
Part 3:



it is neat to hear words I've said time and time and time again, said by someone else :)

Monday, February 04, 2008

Hear hear...

I give a presentation on "worst practices" from time to time




One of the many sections in there regards source code control/configuration management (remember, this is a worst practice talk, not a best practice - so the slides are meant to be ironic, the opposite of what is true)


In there I talk about how many people don't seem to consider their "database schema" (including code for goodness sake!) to be something that you put under source code control.  Nope, you just let everyone in there and let them make changes - in the database directly. 


They consider database code to be less than code - not worthy of being under any sort of change management.  That is why I liked this blog entry I read this morning.

They got it right - dead on.

Think about it...