Sometimes we want to extract a literal value with a SELECT
. This works perfectly fine if the literal value is 1
or 'a'
, but it fails with an error if the value is NULL
. Let’s discuss why and how to solve the problem.
Category: Informix
Find the maximum text length in a column
How to get the length of the longest text in a column. Including Db2 specific syntax.
Grouping rows by a range of values
GROUP BY
allows us to group identical values to aggregate data. What is not obvious is that it can be easily used to group values that belong to the same range, as well.
Create a cross-table unique ID
Most tables are created with a unique, progressive ID. But how to create an ID whose values are unique across multiple tables? For example, if value 1 is in table A, it must not be in table B.