HP c-tree-SQL ISQL and Tools manual Orderinfo, Amount, Sysdate

Models: c-tree-SQL ISQL and Tools

1 99
Download 99 pages 4.83 Kb
Page 46
Image 46

ISQL and Tools

order_info

CHAR

200

order_weight

INT

4

order_value

INT

4

order_state

CHAR

20

ISQL displays the order_info column, at 200 characters, with lots of blank space preceding the values:

ISQL> select order_info from orders where order_value < 1000000

ORDER_INFO

----------

Solid Rods 5 in. diameter

1 record selected

You can improve formatting by using the character format string to limit the width of the dis- play:

ISQL> column ORDER_INFO format "A28" heading "Details"

ISQL> select order_info from orders where order_value < 1000000;

ORDER_INFO

----------

Solid Rods 5 in. diameter 1 record selected

ISQL> -- Illustrate some options with numeric format strings. ISQL> -- No column formatting:

ISQL> select order_value from orders where order_value < 1000000;

ORDER_VALUE

-----------

110000

1 record selected

ISQL> -- Format to display as money, and use different heading: ISQL> column order_value format "$999,999,999.99" heading "Amount" ISQL> select order_value from orders where order_value < 1000000;

AMOUNT

------

$110,000.00

1 record selected

The following examples use the single-value system table, syscalctable, and the sysdate scalar function, to illustrate some date-time formatting. The sysdate function returns today's date.

ISQL> select sysdate from syscalctable; -- No formatting

SYSDATE

-------

05/07/1998

ISQL> column sysdate format "Day" ISQL> select sysdate from syscalctable

SYSDATE

-------

3-20

FairCom Corporation

Page 46
Image 46
HP c-tree-SQL ISQL and Tools manual Orderinfo, Amount, Sysdate