HP c-tree-SQL ISQL and Tools manual Following example illustrates usage of the History statement

Models: c-tree-SQL ISQL and Tools

1 99
Download 99 pages 4.83 Kb
Page 56
Image 56

ISQL and Tools

Description

The HISTORY statement lists the statements in the statement history buffer, along with an identifying number.

Notes

ISQL maintains a list of statements typed by the user in the statement history buffer. The SET HISTORY statement sets the size of the history buffer.

The statements LIST, EDIT, HISTORY, and RUN are not added to the history buffer.

Use HISTORY to obtain the statement number for a particular statement in the history buffer that you want to execute. Then, use the RUN statement with the statement number as an argument to execute that statement. Or, use LIST statement with the statement number as an argument to make the statement the current statement, which can then be executed using RUN without an argument.

Example

The following example illustrates usage of the HISTORY statement.

ISQL> HISTORY -- Display statements in the history buffer

1start start_ex.sql Ship

2SELECT customer_name FROM customers WHERE customer_name LIKE 'Ship%'

3select tbl from systables where tbltype = 'T' ISQL> RUN 2 -- Run the query corresponding to statement 2 SELECT customer_name FROM customers

WHERE customer_name LIKE 'Ship%'

CUSTOMER_NAME

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

Ship Shapers Inc.

1 record selected

ISQL> HI -- In addition to executing, statement 2 is now the current statement

1start start_ex.sql Ship

2SELECT customer_name FROM customers WHERE customer_name LIKE 'Ship%'

3select tbl from systables where tbltype = 'T'

4SELECT customer_name FROM customers WHERE customer_name LIKE 'Ship%'

ISQL> LIST 3 – Display statement 3 and copy it to the end of the history list select tbl from systables where tbltype = 'T'

ISQL> history -- Statement 3 is now also the current statement

1start start_ex.sql Ship

2SELECT customer_name FROM customers WHERE customer_name LIKE 'Ship%'

3select tbl from systables where tbltype = 'T'

4SELECT customer_name FROM customers WHERE customer_name LIKE 'Ship%'

5select tbl from systables where tbltype = 'T'

3-30

FairCom Corporation

Page 56
Image 56
HP c-tree-SQL ISQL and Tools manual Following example illustrates usage of the History statement