• (cs) in reply to RyuO
    RyuO:

    Assuming you mean the development database (developers should not be in the production database), the canonical solution is to keep code in a separate schema whose password is only known by the CM tool. You would also give each developer a personal schema to play around in; Oracle's scope rules give precedence to code in the schema you log in from. In anything but personal schemas, the developer would not have the RESOURCE privilege.

    You can't do much about diabolical DBAs except figure out what they did after the fact.


    I was rather thinking along the line "let the developers toy around in the development database, without too many restrictions; anyway, to deploy the code to the next database (staging or production), it must go through the CM tool". But I recognize your way is probably even better, because this way the CM can merge concurrent changes to the same procedure (or package).

  • (cs) in reply to Michael Casadevall
    Michael Casadevall:
    I can't even think any possible way to even JUSTIFY this one! I mean, the author obviously knows what a stored proceedure is, but he thinks a good way to get out of running proceedure is to call another proceedure which causes the other one to abort with an error. Argh, its too early for this ... my mind, it can't take it this morning.


    The author most likely didn't only want to get out of the calling procedure, but out of all procedures on the call stack. Like exit(0) in C.
  • Harsh (unregistered) in reply to PS

    Puke

  • Fight the Power (unregistered)

    The comments about Office Space do make me wonder if maybe WTFs like this aren't actually intentional.  If it was your job to work an a thoroughly WTF'd system for a prick of a boss, you might very well find subversive little ways to amuse yourself and pretend to fix things while in fact doing as little as possible.

     

  • (cs) in reply to Coughptcha
    Coughptcha:
    I've seen teams branch off a "release" stream and keep the main branch as a development branch (which is incorrect, but workable).

    May I ask why you consider creating a branch devoted to stabilizing a release while the trunk stays a development zone "incorrect"?

  • Terrier (unregistered) in reply to Paul Tomblin

        Hate to show my age but for the reason you mentioned this "divide-bby-zero" error is a venerable old mainframe trick. Back in the day when most programs ran as batch jobs overnight this would give the developer some juicy dumps to pore over the next day after an unsuccessful run.  Of course anyone using this technique now should summarily be shot and their corpse dumped in the nearest bay.

  • Mr_Daemon (unregistered) in reply to merreborn
    merreborn:

    It's awfully nice when your developers actually include a comment in their CVS commits.  It's always a bitch when you know an error was introduced in the last month, in file X, but file X has been committed 12 times without a single commit comment in the last month.  Totally makes the 'cvs log' command useless.


    It's even nicer when you use subversion, and write a pre-commit hook to check the comment lenght and reject commits based on that.

    And Blame is your friend. It's also aliased to "praise", as not to be discriminatory.
  • (cs) in reply to Mr_Daemon

    How about...

    Declare WTF Exception;
    

    Begin If (bad thing happened) Then Raise WTF; End If;

    Exception When WTF Then If (developer = 'Paula') Then If (code is 'Brillant') Then If (booleanFlag = 'FileNotFound') Then exec TDWTF; End If; End If; End If; End If;

  • Schnark (unregistered) in reply to Jalf

    Divide by zero is infinite superior!

    Attempting to create an overflow depends on data types (which might change in future; remember the days when pointers still were two bytes long?). Division by zero is future-proof. This code is prepared for eternity ;-)

  • (cs) in reply to Paul Tomblin
    Paul Tomblin:
    I had already gotten rid of all the other Fortran remnants on the system, so I attacked the big orange wall and found the documentation on how to produce a stack trace in C with a VMS system call.


    LIB$SIGNAL() is a run-time library function, not a system service.

    Can I have my "Nit-Picker of the Week" award now?

    ok
    dpm
  • Dylan (unregistered) in reply to ammoQ

    ammoQ:

    The author most likely didn't only want to get out of the calling procedure, but out of all procedures on the call stack. Like exit(0) in C.

    Ah, yes.  Otherwise known as "exit gracefully"!

    Dylan

  • (cs) in reply to codeman
    codeman:
    How about...

    Declare WTF Exception;
    

    Begin If (bad thing happened) Then Raise WTF; End If;

    Exception When WTF Then If (developer = 'Paula') Then If (code is 'Brillant') Then If (booleanFlag = 'FileNotFound') Then exec TDWTF; End If; End If; End If; End If;


    How about a non-procedural solution?
    <font face="Courier New">SELECT 'WTF' FROM daily_wtf</font>
    <font face="Courier New">WHERE code = 'Brillant'</font>
    <font face="Courier New">OR developer = 'Paula'</font>
    <font face="Courier New">OR forum_software = 'Sucks'</font>
    <font face="Courier New">OR 'insure' <> 'ensure'</font>
    <font face="Courier New">OR poster <> USER</font>
    The list of predicates might need a little work...
  • Vitali2000 (unregistered)

    At least, this is well documented ;)

  • romm (unregistered)

    As someone else said: M. Bolton and Nagheenanajar are characters from Office Space (search @ imdb...)

  • (cs) in reply to Kevan
    Anonymous:
    That's why I love that the Toroise SVN plug in names the compare with earlier version function "Blame"

    The command-line svn client has an "svn blame <name of file>" command too. (Specifically, it shows the latest version of the file, annotated with when each line was last changed and the guilty party - hence the name). As people have already said, "annotate" and "praise" do the same thing (cvs and Mercurial have the same functionality, but only under the name "annotate").

  • Dwonis (unregistered) in reply to Kevan
    Anonymous:
    That's why I love that the Toroise SVN plug in names the compare with earlier version function "Blame"


    It's part of the official Subversion client, as well:
    blame (praise, annotate, ann)

  • Kiss me, I'm Polish (unregistered) in reply to makomk

    I just can't stand the number of persons that point their finger at the two names and say "Hey, that's an Office Space joke! Hey, let's quote some Office Space stuff! Fist!"
    Guys! WE GET THE JOKE! And while you don't look like Jennifer Aniston, and I bet you don't, you can as well go and see the hypnotherapist. In hell.

  • robbak (unregistered) in reply to JoeBloggs
    Anonymous:
    Jojosh_the_Pi:
    The least they could have done is to condense the procedure into 1 line. Unless for some reason,
    v_divzero := 7 / 0;
    throws a different error.
    That might error out at compile time (for example, if it does constant folding) rather than at runtime.


    Surely any optimising compiler would also optimise that variable out of existance too?

    Not that SQL stored procedures are optimising compilers!!
  • Fred (unregistered) in reply to ammoQ
    ammoQ:
    Anonymous:

    Nice way to terminate the application, but I would rather use an infinite loop or something...



    Beware. This is PL/SQL. If you do an infinite loop, it _will_ run forever.

    Well, a infinite loop is supposed to runs forever, or at least a very long time. Otherwise it would be called 'infinite loop with short expiration time'.
    This leads to the more_infinite loop, which would be 'infinite loop with medium expiration time'.
    And finally most_infinite loop, ...... ah.. you get the picture...

    ....signature snipped....
  • Fred (unregistered) in reply to foxyshadis
    Anonymous:
    CodeWhisperer:

    That's what source control management systems are for.  Keeps track of who made what changes and even gives them a space to explain why they changed what they did.  That way the company has the info, but anyone who stumbles on the code doesn't.  


    No one brought this up yet? How, exactly, do you get a COMMIT LOG from a set of STORED PROCEDURES? Unless you have a diabolical DBA who runs every update through source control before uploading it, how do you get people to not abuse it?


    1) Discipline
    2) Object versions in database
    3) Object source checksum (and compare)
    4) Whipping if all above does not work
  • (cs)

    Damn!! Alex does a good job of cleaning up names in the offending WTFs.
    The trail of the S. Nagheenanajar and M. Bolton all end up at Office Space. Somehow the WTFs all seem to be manufactured.

  • Anonymous (unregistered) in reply to Fred
    Anonymous:
    ammoQ:
    Anonymous:

    Nice way to terminate the application, but I would rather use an infinite loop or something...



    Beware. This is PL/SQL. If you do an infinite loop, it _will_ run forever.

    Well, a infinite loop is supposed to runs forever, or at least a very long time. Otherwise it would be called 'infinite loop with short expiration time'.
    This leads to the more_infinite loop, which would be 'infinite loop with medium expiration time'.
    And finally most_infinite loop, ...... ah.. you get the picture...

    ....signature snipped....


    The Cray-3 is so fast it can execute an infinite loop in under 2 seconds!
  • zde (unregistered)

    I know Oracle sucks big time and PL/SQL is horrible, but am still surprised that exception handling was documented so poorly.

  • Carfield (unregistered)

    When I just google " S. Nagheenanajar " and google return this page as one of the top 5 result, amazing!

Leave a comment on “Insuring Proper Error Handling”

Log In or post as a guest

Replying to comment #:

« Return to Article