1 2 3 4 Previous Next 47 Replies Latest reply: Jan 10, 2014 1:10 PM by Hoek Go to original post RSS
      • 45. Re: REGEXP_LIKE, oh where for art thou?
        Frank Kulash

        HI,

         

        Oracle provides a default exception handler.  It will produce clearer, more accurate error messages than what you posted.  If you can't improve on the default, don't use an EXCEPTION section at all.  EXCEPTION is never required.

         

        Read the AskTom page that Hoek cited.

        • 46. Re: REGEXP_LIKE, oh where for art thou?
          Xev Bellringer

          Hi Frank,

           

          Ok, this I read the infamous ask page. I will work on that after I get these strings concatenatoed. I just tried to use the (CONCAT function), but it didn't work.

          So I am basically stuck in the water as of right now.

           

          I am going to open another thread, and just focus on the actual "concatenation" of the regexp strings.

          I think that way, everyone can understand things much better...

           

           

          • 47. Re: REGEXP_LIKE, oh where for art thou?
            Hoek

            "Catch all until it works" is totally the wrong way, unless you want to put some unreliable code that can corrupt your database in a fricking, hard to debug, mean way into production.

            You start developing and AT FIRST YOU CATCH TOTALLY NOTHING in your pl/sql block, you start without an exception block, test various scenario's and see what happens. So: No exception handling at all (unless during design time has already foreseen certain errors that might occur, but will not do damage to the transaction and DOCUMENTED that, keep in mind that exceptions usually occur when you're doing transactional stuff, and we want an entire transaction to complete sucessfully without errors).

            During development you will get errors (or not) and then you determine if the error is a valid one or something UNEXPECTED (it might well be a design flaw).

            I mean 'valid' in terms of 'yes, this error is to be expected and can specifically be handled with', like NO_DATA_FOUND and so on.

            If you just boldly catch it all, change the error message, and all that without RE-RAISING the error, you'll be spending lots of time debugging something in production that you could already easily have tackled during development time.

             

            I spent way too much time in the past ending up with a WHEN OTHERS turning errors into NOT an error.

            At least put a RAISE in your WHEN OTHERS if you insist on using it.

            I discourage such an approach, I try to program to succeed and not to fail.

            Using a WHEN OTHERS (without a RAISE) = "Geez, I totally don't know what I'm doing and I don't care at all about transactions and I'm programming for failure but nobody has to know, so I'll hide it all"

            From 11g and onwards the compiler will tell you you're swallowing errors.

            As Frank said: read that rant (whenever you have the time), and bookmark Tom's site. Search

            It is a vast wealth of practical knowledge, explanations and tells you how Oracle Database keeps on changing every release. Lots of OTN questions are already thoroughly answered there.

            1 2 3 4 Previous Next