Some DBMSs have a pi() function to give the value of π. I can’t find the equivalent for Db2.
I can use radians(180), I suppose, but is there something more direct?
Some DBMSs have a pi() function to give the value of π. I can’t find the equivalent for Db2.
There is none in DB2.
I can use radians(180), I suppose, but is there something more direct?
You can use RADIANS(180) or ACOS(-1) , both will return 3.141592653589793
SELECT ACOS(-1) AS PI_a, RADIANS(180) AS PI_b FROM SYSIBM.SYSDUMMY1; You could also create a function with a static value , something like
CREATE FUNCTION PI() RETURNS DOUBLE DETERMINISTIC NO EXTERNAL ACTION RETURN 3.141592653589793; acos(-1) - radians(180) returns 0, showing there’s no subtle difference in the nth decimal place.