rem Name: math.sql Type: start file report rem Written by: G. Koch Date: 2/4/90 rem rem Description: Illustrates ORACLE math functions. Produces rem an output file named MATH.LST set echo off set pagesize 32000 set linesize 132 column Plus format 99.999 column Minus format 999.999 column Times format 9999.999999 column Divided format .999999 column VSIZE(Above) heading 'VSIZE|(Above)' column VSIZE(Below) heading 'VSIZE|(Below)' column VSIZE(Empty) heading 'VSIZE|(Empty)' column NVL(Above,11) heading 'NVL|(Above,11)' column NVL(Below,11) heading 'NVL|(Below,11)' column NVL(Empty,11) heading 'NVL|(Empty,11)' column ROUND(Above,2) heading 'ROUND|(Above,2)' column ROUND(Below,2) heading 'ROUND|(Below,2)' column TRUNC(Above,2) heading 'TRUNC|(Above,2)' column TRUNC(Below,2) heading 'TRUNC|(Below,2)' column ROUND(Above,0) heading 'ROUND|(Above,0)' column ROUND(Below,0) heading 'ROUND|(Below,0)' column TRUNC(Above,0) heading 'TRUNC|(Above,0)' column TRUNC(Below,0) heading 'TRUNC|(Below,0)' column ROUND(Above,-1) heading 'ROUND|(Above,-1)' column ROUND(Below,-1) heading 'ROUND|(Below,-1)' column TRUNC(Above,-1) heading 'TRUNC|(Above,-1)' column TRUNC(Below,-1) heading 'TRUNC|(Below,-1)' set echo on set numwidth 7 set numformat "" spool math.lst select Name, Above, Below, Empty from MATH; select Name, Above, Below, Empty, Above + Below "Plus", Above - Below "Minus", Above * Below "Times", Above / Below "Divided" from MATH where Name = 'HIGH DECIMAL'; select Name, Above, Below, Empty, Above + Empty "Plus", Above - Empty "Minus", Above * Empty "Times", Above / Empty "Divided" from MATH where Name = 'HIGH DECIMAL'; select Name, Above, Below, Empty, ABS(Above), ABS(Below), ABS(Empty) from MATH where Name = 'HIGH DECIMAL'; select Name, Above, Below, Empty, VSIZE(Above), VSIZE(Below), VSIZE(Empty) from MATH; select Name, Above, Below, Empty, NVL(Above,11), NVL(Below,11), NVL(Empty,11) from MATH where Name = 'HIGH DECIMAL'; select Name, Above, Below, CEIL(Above), CEIL(Below) from MATH; select Name, Above, Below, FLOOR(Above), FLOOR(Below) from MATH; select Name, Above, Below, MOD(Above,11), MOD(Below,11) from MATH where Name = 'HIGH DECIMAL'; set numformat 9999.999999 select Name, Above, Below, POWER(Above,2), POWER(Below,2) from MATH where Name = 'HIGH DECIMAL'; select Name, Above, Below, POWER(Above,2.9), POWER(Below,2.9) from MATH; set numformat "" select Name, Above, Below, SQRT(Above), SQRT(Below) from MATH where Name = 'HIGH DECIMAL'; select Name, Above, Below, ROUND(Above,2), ROUND(Below,2), TRUNC(Above,2), TRUNC(Below,2) from MATH; select Name, Above, Below, ROUND(Above,0), ROUND(Below,0), TRUNC(Above,0), TRUNC(Below,0) from MATH; select Name, Above, Below, ROUND(Above,-1), ROUND(Below,-1), TRUNC(Above,-1), TRUNC(Below,-1) from MATH; select Name, Above, Below, SIGN(Above), SIGN(Below) from MATH where Name = 'HIGH DECIMAL'; spool off