1 2 3 Previous Next 33 Replies Latest reply: Feb 5, 2013 5:02 AM by Bawer Go to original post RSS
      • 30. Re: good practice question
        BluShadow
        Marwim wrote:
        An exception is nothing to avoid at any price. It's a tool just like other features of PL/SQL and should be used.
        Well said. ;)
        • 31. Re: good practice question
          Bawer
          Marwim wrote:
          I would use ...
          This kind of code would not pass my code review.
          1. a LOOP to select a single value hides the fact that you expect a single value and makes the code less clear.
          2. you need to explicitly check for a none existing value or too many values
          If i should check too many values, there are aggregate functions to use in query. (but I hadn't this because I know what I write)
          Marwim wrote:
          In your code you simply call
          variable_xy := getValue();
          Nice, clean, no anonymous block and clear about the purpose.
          There is a difference between "trying to avoid exceptions if possible" and "don't use exceptions", I hope you understood now.
          And your example is query-specific. I don't write a function for every possible exception!
          and your call is just only for one variable, if you have 20 variables, would you call the function 20 times and define 20 variables? or define any object/rec and write a new function again? or bla bla bla...
          This is your style and again it is not my style.
          Marwim wrote:
          An exception is nothing to avoid at any price.
          boring!
          Marwim wrote:
          It's a tool just like other features of PL/SQL and should be used.
          It is used, but not every time it is needed.
          • 32. Re: good practice question
            Marwim
            This is your style and again it is not my style.
            No problem as long as you don't write code for my applications :-)
            • 33. Re: good practice question
              Bawer
              Marwim wrote:
              This is your style and again it is not my style.
              No problem as long as you don't write code for my applications :-)
              I can't imagine yours :-)
              1 2 3 Previous Next