11. Report-Writer Expressions and Formats : Types of Data in Expressions : Columns
 
Share this page                  
Columns
To reference a column value in a data row currently being processed, you can:
Specify the database column name directly
Reference the column by a name you give it in the as clause of a select statement within the .query statement
You can use the select as construct in a .query statement to select a column by its correlation name, which is not recognized by Report-Writer, and then give it another name, which you can use in Report-Writer statements. You can also use this construct to select a column whose name is a delimited identifier, and give it another name that is easier to reference in other Report-Writer statements.
To reference a column from a database table by a name other than its actual database column name, use the following construct in a .query statement:
select columnname as resultcolumn from tablename
Thereafter, refer to the column by its result name, as in the following print statement:
.print resultcolumn
After assigning a result name in the query, any references to columnname causes an error.
Use a delimited identifier (see Delimited Identifiers) to reference a column that contains spaces or other non-alphanumeric characters, or that is identical to a reserved word.
Columns are comprised of one of the following types of expressions:
Numeric
Character
Abstract
This table shows the SQL data types that belong to each of these categories. See the QUEL User Notes for QUEL data types.
Numeric
Character
Abstract
decimal
char
date
float
c
money
float4
text
 
float8
varchar
 
integer1
 
 
integer2 (smallint)
 
 
integer4
 
 
Report-Writer perceives and treats a user-defined (UDT) data type as a character string. It does not recognize columns of data types long varchar, byte, byte varying, and long byte. If you specify a column of this data type in the query, Report-Writer silently ignores and does not print values for that column.
Note:  If Report-Writer encounters subsequent references to a column of the long varchar, byte, byte varying, and long byte data types--for example, in sort operations--it issues an error message and terminates the report.
QUEL User Notes
The QUEL data types that belong to these categories are listed in the following table:
Numeric
Character
Abstract
f4
char
date
f8
c
money
i1
text
 
i2
varchar
 
i4