I had the same problem to solve inside the plsql procedure. The solution above is completely correct, and I did the same. But it dramatically worsened the performance of my plsql program. Instead of calculating the circle, I used a square. Because it can be done without performing such a calculation in the sql expression itself. This improved query performance by over 10x
source share