Marwim wrote: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)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
Marwim wrote:There is a difference between "trying to avoid exceptions if possible" and "don't use exceptions", I hope you understood now.
In your code you simply callNice, clean, no anonymous block and clear about the purpose.
variable_xy := getValue();
An exception is nothing to avoid at any price.
Marwim wrote:It is used, but not every time it is needed.
It's a tool just like other features of PL/SQL and should be used.