HP c-tree-SQL ISQL and Tools manual Isql Statements for Query Formatting Summary, Display

Page 30

ISQL and Tools

ISQL includes several statements that provide simple formatting of SQL queries. The follow- ing table summarizes the ISQL query-formatting statements.

Table 3-2: ISQL Statements for Query Formatting

Statement

Summary

 

 

DISPLAY

Displays text, variable values, and/or column values after the

 

specified set of rows (called a break specification). See Section

 

3.7.7 "DISPLAY" on page 3-23 for details.

 

 

COMPUTE

Performs aggregate-function computations on column values for

 

the specified set of rows, and assigns the results to a variable.

 

DISPLAY statements can then refer to the variable to display its

 

value. See Section 3.7.5 "COMPUTE" on page 3-21 for details.

 

 

BREAK

Specifies at what point ISQL processes associated DISPLAY and

 

COMPUTE statements. BREAK statements can specify that pro-

 

cessing occurs after a change in a column's value, after each

 

row, after each page, or at the end of a query. DISPLAY and

 

COMPUTE statements have no effect until you issue a BREAK

 

statement with the same break specification. See Section 3.7.2

 

"BREAK" on page 3-13 for details.

 

 

DEFINE

Defines a variable and assigns a text value to it. When DISPLAY

 

statements refer to the variable, ISQL prints the value. See Sec-

 

tion 3.7.6 "DEFINE" on page 3-23 for details.

 

 

COLUMN

Controls how ISQL displays a column's values (the FORMAT

 

clause) and/or specifies alternative column-heading text (the

 

HEADING clause). See Section 3.7.4 "COLUMN" on page 3-16

 

for details.

 

 

TITLE

Specifies text and its positioning that ISQL displays before or

 

after it processes a query. See Section 3.7.23 "TITLE" on page

 

3-42 for details.

 

 

CLEAR

Removes settings made by the previous DISPLAY, COMPUTE,

 

COLUMN, BREAK, DEFINE, or TITLE statements. See Section

 

3.7.3 "CLEAR" on page 3-15 for details.

 

 

SET LINESIZE

Specifies various attributes that affect how ISQL displays queries

SET PAGESIZE

and results.

SET REPORT

 

SET ECHO

 

 

 

The rest of this section provides an extended example that illustrates how to use the statements together to improve formatting.

3-4

FairCom Corporation

Image 30
Contents Isql and Tools Reference Guide For use with c-treeSQL ServerPage Table of Contents Data Load Utility dbload Tutorial Source Code IiiFairCom Corporation Purpose of this Manual Syntax Diagram ConventionsDocumentation Overview AudienceRelated Documentation Isql and ToolsIntroduction OverviewIsql and Tools FairCom Corporation Init Quick TourIntroductory Tutorial IsqlIsql Create Table Custmast DefineManage Isql Commit Work CustmastDone Complete Introductory Tutorial CodeQuick Tour Relational Model and Indexing Tutorial ISQLTutorial2.sqlQuick Tour Insert Into Values Insert IntoValues Commit Work QTY PriceComplete Relational Model and Indexing Tutorial Source Code Locking Tutorial ISQLTutorial3.sql@ISQL @iSQLTutorial3.sql Isql Delete from Custmast Complete Locking Tutorial Source Code Transaction Processing Tutorial ISQLTutorial4.sqlTransaction Rollback Work Complete Transaction Processing Tutorial Source Code Syntax Isql StatementsStarting Interactive SQL ArgumentsUsername PasswordStatement History Support ConnectstringIsql Statements for Statement History Support Formatting Output of Isql QueriesIsql Statements Statement SummaryIsql Statements for Query Formatting Summary DisplayExample 3-1 Unformatted Query Display from Isql Customername Customercity Orderid OrdervalueFormatting Column Display with the Column Statement Example 3-2 Controlling Display Width of Character ColumnsExample 3-3 Customizing Format of Numeric Column Displays OrdervalueCustomername Customercity Example 3-4 Specifying Column Breaks and Values with Display Numorders Customername Example 3-6 Specifying a Query Header and Footer with Title Help and Table Statements Transaction SupportDescription Isql Reference1 @ Execute Syntax ExampleBreak Syntax BreakspecExamples Skip nCustomername Clear Syntax HistoryOption ArgumentColumn Syntax Break Column Compute Display TitleColumnname Format formatstringHeading headingtext Date-Time Format Strings for the Column Statement Character DescriptionNull ? Type Length Colname Not Null INTChar Orderinfo AmountSysdate NEW Title FLDColumn Title ComputeAVG MAX MIN SUM Count VariablenameDefine Syntax ValueCOL columnnumber ColpositionDisplayvalue @columnnameEdit Syntax Exit or Quit Syntax Related StatementsExit 10 GET Syntax Isql GET query.sqlIsql RUN History Syntax Help CommandsclausesHelp Syntax Orderstate LotlocationFollowing example illustrates usage of the History statement Hostcommand Host or SH or SyntaxFrom List Syntax Quit Quit or Exit Syntax16 RUN Syntax Isql HistoryPagesize Save Syntax18 SET Syntax LinesizePagesize numberlines Isql Break on Isql Select TBL from Systables TBL Connection databasename DefaultTransaction Isolation Level isolationlevel TBLShow Syntax Filename on Is Default ?Spool Syntax Database ConnectionsIsql Spool STK on Start SyntaxArgument … Isql Spool OFFNull ? Type Length Colname Not Null INT Not Null VarcharTablename Type Length Colname Null ?Date Text Title SyntaxLeft Center Right COL n DoubleIsql Clear Title Isql and Tools FairCom Corporation Data Load Utility dbload IntroductionPrerequisites for Dbload Dbload Command Line SyntaxCommandsfile OptionsData File Formats Data Load Utility dbloadFixed Length Records Commands FileVariable Length Records Next RecordDefine Record Statement Char Short Long Float DoubleFor Each Statement NullExample 4-1 Sample dbload commands files ExamplesCompilation Errors Record name redefinedPosition not specified for fixed length record Fatal Errors Isql and Tools FairCom Corporation Data Unload Utility dbdump Prerequisites for DbdumpDbdump Command Line Syntax Data Unload Utility dbdump Short Long Float DoubleFor Record Statement Define Record custrec of Fixed Length 37 AS Isql and Tools FairCom Corporation Schema Export Utility dbschema Username.tablename Username.procedurenameOutfile Username.triggernameImport Begin Schema Export Utility dbschemaDbschema ENDIsql and Tools FairCom Corporation Tutorial Source Code Commit Work Select * from Custmast Delete from CustmastInteger MoneyVARCHAR6 Tutorial Source Code Commit Work Delete from CustmastImdesc VARCHAR48 Select * from orderlist Select * from orderitems Isql and Tools FairCom Corporation Symbols Index-iIsql Index-ii FairCom CorporationIndex Index-iii FairCom Corporation