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. For example:
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 )
In this section:
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.
Copyright © 2005. Sybase Inc. All rights reserved. |