
ISQL and Tools
3-30 FairCom Corporation
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
1 start start_ex.sql Ship
2 SELECT customer_name FROM customers
WHERE customer_name LIKE 'Ship%'
3 select 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
1 start start_ex.sql Ship
2 SELECT customer_name FROM customers
WHERE customer_name LIKE 'Ship%'
3 select tbl from systables where tbltype = 'T'
4 SELECT 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
1 start start_ex.sql Ship
2 SELECT customer_name FROM customers
WHERE customer_name LIKE 'Ship%'
3 select tbl from systables where tbltype = 'T'
4 SELECT customer_name FROM customers
WHERE customer_name LIKE 'Ship%'
5 select tbl from systables where tbltype = 'T'