A computed column is defined by an expression.You can build the expression by combining regular columns in the same row. Expressions may contain functions, arithmetic operators, case expressions, other columns from the same table, global variables, Java objects, and path expressions.
In the example below:
part_no is a Java object column that represents the specified part number.
desc is a text column that contains a detailed description of the specified parts.
spec is an image column that stores the parsed XML stream object.
name_order is a computed column defined by the user-defined function XML().
version_order is a computed column defined by the Java class.
descr_index is a computed column defined by des_index(), which generates an index key on the text data.
spec_index is a computed column defined by xml_index(), which generates an index key on the XML document.
total_cost is a computed column defined by an arithmetical expression.
create table parts_table (part_no Part.Part_No, name char(30), descr text, spec image, listPrice money, quantity int, name_order compute name_order(part_no) version_order compute part_no version, descr_index compute des_index(descr), spec_index compute xml_index(spec) total_cost compute quantity*listPrice )