SQL Functions

DB2 contains a large number of built-in column and scalar functions that can add flexibility to the type of calculations you can perform against the data. These functions can be broken down into the following categories:

  • Trigonometric functions (COS, SIN, TAN, COT, TANH, COSH, SINH, ATAH, ATAN2)

  • Math functions (INTEGER, FLOOR, CEILING, TRUNC, SQRT, LN, EXP)

  • String functions (RTRIM, LTRIM, INSTR, TRANSLATE, REPEAT, REPLACE, CONCAT, SUBSTR, LENGTH, LOWER, UPPER)

  • Statistical functions (CORRELATION, STDDEV, VARIANCE)

  • Date functions (DATE, TIME, TO_CHAR, TO_DATE, DAYNAME, DAYOFWEEK)

  • Logic functions (COALESCE, NULLIF)

  • Specialty functions (MQPUBLISH, MQREAD, ENCRYPT, REC2XML)

There are many more functions available within DB2 that you can use. ...

Get DB2® Version 8: The Official Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.