Product Documentation

FairCom ISQL

Previous Topic

Next Topic

DISPLAY

Syntax

DISPLAY { [ col_position ] display_value } [ , ... ] ON break_spec ;

col_position::

{ COL column_number | @ column_name }

display_value::

{ "text string" | variable | column_name }

break_spec::

{ column_name | ROW | PAGE | REPORT }

Description

The DISPLAY statement displays the specified text, variable value, and/or column value after the set of rows specified by break_spec. DISPLAY statements have no effect until you issue a BREAK statement with the same break_spec.

Issuing the DISPLAY statement without any arguments displays the currently set DISPLAY specifications, if any.

Arguments

col_position

An optional argument that specifies the horizontal positioning of the associated display value. There are two forms for the argument:

COL column_number

Directly specifies the column position of the display value as an integer(1 specifies column 1, 2 specifies column 2, and so on.).

@column_name

Names a column in the select list of the SQL query. ISQL aligns the display value with the specified column.

If the DISPLAY statement omits col_position, ISQL positions the display value at column 1.

display_value

The value to display when the associated break occurs:

“text string”

If the display value is a text string, ISQL simply displays the text string.

variable

If the display value is a variable, ISQL displays the value of the variable when the associated break occurs. The variable argument refers to a variable named in a COMPUTE or DEFINE statement that executes before the query. If variable is undefined, ISQL ignores it.

column_name

If the display value is a column name, ISQL displays the value of the column when the associated break occurs. The column specified in column_name must also be included in the select list of the query. If column_name is not also included in the select list, it has no effect. If a COLUMN statement specifies a format for the same column, the formatting also affects the DISPLAY statement.

break_spec

Specifies the set of rows after which ISQL processes the DISPLAY statement. A DISPLAY statement has no effect until you issue a corresponding BREAK statement. See the description of the BREAK statement in "BREAK" for details of break specifications.

Examples

The following set of examples compute the number of orders placed by each customer and displays the message Number of orders placed by, followed by the customer name and the count of orders.


ISQL> break on customer_name

ISQL> display col 5 "Number of orders placed by", customer_name, "=", n_ord on customer_name

ISQL> compute count of order_id in n_ord on customer_name;

ISQL> select c.customer_name, o.order_id from customers c, orders o

where o.customer_id = c.customer_id;

CUSTOMER_NAME ORDER_ID

------------- --------

Sports Cars Inc. 1

Sports Cars Inc. 2

Number of orders placed by Sports Cars Inc.

= 2

Mighty Bulldozer Inc. 3

Mighty Bulldozer Inc. 4

Number of orders placed by Mighty Bulldozer Inc.

= 2

Ship Shapers Inc. 5

Ship Shapers Inc. 6

Ship Shapers Inc. 7

Number of orders placed by Ship Shapers Inc.

= 3

Tower Construction Inc. 8

Tower Construction Inc. 9

Tower Construction Inc. 10

Number of orders placed by Tower Construction Inc.

= 3


If the select-list of a query includes column titles, they override DISPLAY statements that include variable or column_name display values for those columns:


ISQL> display col 5 "test display. Sum of fld is", tmp on fld;

ISQL> compute sum of fld in tmp on fld;

ISQL> break on fld

ISQL> select fld from syscalctable; -- This works:

FLD

---

100

test display. Sum of fld is 100

1 record selected

ISQL> select fld "column title" from syscalctable; -- DISPLAY is disabled:

COLUMN TITLE

------------

100

1 record selected


TOCIndex