Geeks around the world will be celebrating Pi day, a shameless excuse to put the month before the day like the Americans do so we can talk Mathematics on “3.14” day
So what better way to show how cool SQL can be with some expressions to approach Pi with continuous series
All we really need to know by way of background is the CONNECT BY LEVEL trick to generate arbirtary sequences of row, eg
SQL> select level from dual connect by level <= 5; LEVEL ---------- 1 2 3 4 5
Now we can get some approximations to Pi using the some of the standard SQL functions SQRT and POWER
In Oracle, DUAL is just a convenience table. You don't need to use it, you can use anything you want. PeopleSoft applications often use PS_INSTALLATION when they needs a single row source in a query. This was another example of platform agnosticism. PS_INSTALLATION is available on every platform and every PeopleSoft installation, DUAL is not.
Instead of coding this (the example is taken from ESPP_REF_REVMAIN.PSHUP.Do When)