The $COL_LEN and $COLUMN_LENGTH functions return the defined length of a column. The return data type is a 4-byte INTEGER. Both functions are identical.
These functions differ from the CHAR_LENGTH and CHARACTER_LENGTH functions:
$COL_LEN and $COLUMN_LENGTH return the length defined for the column in the Omnidex Environment Catalog. CHAR_LENGTH and CHARACTER_LENGTH return the actual length of the data contained in the column for that record.
The return data type is a 4 byte integer.
$COL_LEN( <column_spec | 'string' > )
<column_spec | 'string' > Required. An unambiguous column name. Resolve ambiguities by qualifying the column name with the table name and database name if necessary.
$COL_LEN(tablename.columnname)
$COLUMN_LENGTH(databasename.tablename.columnname)
If this function is used in a SQL SELECT, INSERT, or UPDATE statement, then the column parameter must be from one of the tables referenced in the statement. If this function is used in a COLUMN statement within an environment file, then column must be the column being declared.
select company, $col_len(company), char_length(company) from customers where company='national computer' Company: National Computer Systems $COLUMN_LENGTH: 40 CHARACTER_LENGTH: 25