We saw in another article how to build an array from an SQL query (from each row, or from a column). This article shows how to loop over an array items.
Db2: How to create an array from a query
Db2 ordinary arrays can be constructed and populated from an SQL query. Let’s see how to do it.
Db2: How to create IDENTITY columns
Db2 supports the
IDENTITY keyword to create autoincremental columns. Several options are available.
Db2: Stored procedures examples in SQL
Simple examples of SQL stored procedures in Db2.
Db2 hash functions: HASH(), HASH4(), HASH8()
Db2 supports three different hash functions, and each of them can use different algorithms. Let’s shred some light on them to understand their use cases.
Db2 temporary tables: ON COMMIT and ON ROLLBACK
Let’s see how to preserve, empty or drop temporary tables when a transaction succeeds (
COMMIT) or fails (
Db2: Working with aliases
Let’s see how to create, modify and use an alias in Db2. An alias can refer to a table, a sequence or a module. Aliases exist in several databases, but we’re focusing on Db2 syntax here.
Comments on database objects
Why and how to write comments on database, tables, and other objects on most DBMSs. How to read comments.
Db2: Copying a table
How to create a copy of a table. The copy can contain data, a selective portion of the data, or it can be empty.
Db2 triggers: FOR EACH ROW, FOR EACH STATEMENT, DB2ROW, DB2SQL
There is some confusion about the
FOR EACH, the
MODE, and the
AFTER clauses of Db2
CREATE TRIGGER. While other clauses are common to most DBMSs,
MODE is a Db2 unique feature. Their meaning is simpler than it seems.