ABS

<< Click to Display Table of Contents >>

Navigation:  Streaming SQL Reference Guide > Basic Building Blocks > Functions > Scalar Functions >

ABS

Previous pageReturn to chapter overviewNext page

ABS ( <numeric-expression>  <interval-expression> )

Returns the absolute value of the input argument. Returns null if the input argument is null.

Examples

Function

Result

ABS(2.0)

2.0

ABS(-1.0)

1.0

ABS(0)

0

ABS(-3 * 3)

9

ABS(INTERVAL '-3 4:20' DAY TO MINUTE)

INTERVAL '3 4:20' DAY TO MINUTE

In SQLline, using "cast as VARCHAR" to show the output, the value is returned as "+3 04:20".

values(cast(ABS(INTERVAL '-3 4:20' DAY TO MINUTE) AS VARCHAR(8)));

 +-----------+

   EXPR$0  

 +-----------+

  +3 04:20  

 +-----------+

 1 row selected