SQL ABS or ABSVAL scalar function in DB2 for i SQL |
ABS or ABSVAL
The ABS or ABSVAL function returns the absolute value of a number.
ABS(Numeric Expression)
Or
ABSVAL(Numeric Expression)
Example#1 using ABS/ABSVAL built-in scalar function
select abs(-10) from sysibm.sysdummy1
Or
select absval(-10) from sysibm.sysdummy1
Output
ABS ( - 10 ) 10
Example#2 using ABS/ABSVAL built-in scalar function
select abs(1) from sysibm.sysdummy1
Or
select absval(1) from sysibm.sysdummy1
Output
ABS ( 1 ) 1