I was answering this question on plsqlchannel.com yesterday. I was way too confident that my answer was correct that I clicked the answer without giving it even a second thought. It was only when I saw my rank drop a whopping 30 points that I noticed the blunder that I did. The first blunder is that I should have cross checked my result once before submitting. Cause getting it right is more important that getting it faster. This is one thing that I have to relearn and hopefull teach my daughter. And the second is that I did'nt know that TRANSLATE always needs all the three arguments as not nulls. If anyone of them is a null then the result would be a null.
I was under the impression that TRANSLATE('ABCD','BCD','') would simply replace the 'BCD' with the '' and the reuslt would be 'A' . But I was utterly wrong. TRANSLATE would not do this. There is another function for this kind of a thing and we need to use REPLACE for that. REPLACE('ABCD','BCD','') would give the result of 'A'.
One thing to learn today. Actually two things. One in Oracle and one in Life. Get it right not just fast.
No comments:
Post a Comment