DB2: Zero Matching Rows Then Which Value Function Returns

DB2 Aggregate functions also called Column functions.

Example:

SELECT MAX(VALUE_1) FROM SAMPLES.TABLE_1;

Rules:

  • All aggregate functions, we need to use only in SELECT statement
  • If no row found, we will not get +100 sqlcode, instead we will get NULL value
  • The return value from all Aggregate functions can be NULL, but for COUNT and COUNT_BIG always numeric result
  • COUNT always return integer
  • COUNT_BIG always return DECIMAL
  • DISTINCT can be applied on all aggregate functions. But has no effect on MAX and MIN functions

Discover more from Srinimf

Subscribe now to keep reading and get access to the full archive.

Continue reading