SQL DIGITS scalar function in DB2 for i SQL

SQL DIGITS scalar function in DB2 for i SQL
SQL DIGITS scalar function in DB2 for i SQL, sql db2, ibmi, sql function, scalar function
SQL DIGITS scalar function in DB2 for i SQL

DIGITS

The DIGITS function returns a absolute value character string of a number.

Syntax

DIGITS(numeric-expression)

The argument should be an expression that returns a value that is a SMALLINT, INTEGER, BIGINT, or DECIMAL built-in numeric data type. The result does not include a sign or a decimal point. The result can be null if argument is null.

Example

SELECT digits(-554546.40) FROM sysibm.sysdummy1

Output:

DIGITS  
55454640

Here, the output does not contain sign as provided in the argument and it does contain leading zero in the output even after decimal places.

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain