HPlogo ALLBASE/ISQL Reference Manual: HP 9000 Computer Systems > Chapter 4 ISQL Commands

START

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The START command executes one or more SQL or ISQL commands from the command buffer or a command file. The command(s) may contain parameters to which you assign values at execution time.

Scope

ISQL only.

ISQL Syntax

STA[RT] [CommandFileName] [ (Value[, Value][ ... ]) ]

Parameters

CommandFileName

identifies a command file. Name qualification follows HP-UX conventions:

 

   [PathName/]FileName

Unless you specify an absolute path name, ISQL assumes that any path name you specify is relative to your current working directory. If CommandFileName is omitted, ISQL executes any command(s) currently in the command buffer.

Value

is a value to be substituted for a parameter in a command. Parameters in commands are identified with an ampersand (&) and a number from 1 through 100. Use a comma to separate values that correspond to different parameters. When you provide multiple values for a single parameter, separate those values with commas and enclose them in double quotation marks; for example, "value 1, value 2" are values for one parameter. The value provided for one parameter cannot exceed 80 bytes. If more values are specified than are needed, the unnecessary values are ignored.

Description

  • Within any single command file or command buffer, each parameter number can assume only one value or set of values. Therefore, you can refer to the same parameter more than once, but supply its value(s) only once. For example:

     
    
       isql=> HOLD INFO &1\; SELECT &2 FROM &1;
    
       isql=> START (PurchDB.Parts, "PartName,SalesPrice");
    

    ISQL assigns the first value, PurchDB.Parts, to parameter &1 and the second value, PartName,SalesPrice, to parameter &2.

  • The following summarizes how parameter values you pass in the START command are interpreted by ISQL when a parameter is defined within single quotation marks (INFO '&1') or without them (INFO &1):

     
    
    
    
          HOW VALUE IS PASSED                   HOW    VALUE IS INTERPRETED
    
                                                  &1                '&1'
    
       START (   purchdb.parts   )           purchdb.parts       'purchdb.parts'
    
       START (  'purchdb.parts'  )           purchdb.parts       'purchdb.parts'
    
       START ("\'purchdb.parts\'")          'purchdb.parts'     ''purchdb.parts''
    
       START ('\'purchdb.parts\'')          'purchdb.parts'     ''purchdb.parts''
    
       START ('\"purchdb.parts\"')          "purchdb.parts"     '"purchdb.parts"'
    

    Object names enclosed in double quotes cannot be split across lines.

  • To put commands in the command buffer, use one of the following ISQL commands:

    HOLD RECALL FILE RECALL HISTORY

    When commands are placed in the command buffer, ISQL concatenates the command lines.

  • When you use the START command to execute command files, two SET options affect processing:

    • If ECHO is on, commands and comments in the file are displayed as ISQL reads them. If ECHO is off, they are not displayed. Error messages and normal command output are always displayed.

    • If CONTINUE is on, ISQL continues processing commands from a file if an error is encountered. If CONTINUE is off, command file processing terminates if ISQL encounters an error. In either case, ISQL displays the command in error and an error message.

  • You can create command files with ISQL's EDIT or STORE commands. You can also create command files in the HP-UX environment using an editor. Put information to be processed in the first 80 bytes of each line only. Terminate each ISQL and SQL command in the file with a semicolon. Delimit comments with /* before the first comment character and */ after the last comment character. Commands and comments can span lines.

  • When executing command files containing parameters, ISQL prompts you for values if they are not supplied in the command line.

  • When you use the RECALL command to put a single command greater than 32K bytes into the command buffer, it is truncated and the START command cannot be used.

  • A command in the command buffer cannot be executed with a START in a command file.

  • You can include as many as nine recursive command files within a command file.

Authorization

You must have the corresponding authority for each SQL statement and ISQL command contained in the buffer or command file.

Example

 

   isql=> EDIT MyFile;



     .

     .

     .



   /*This file updates statistics of table &1

   and does several SELECT operations.*/



   UPDATE STATSTICS FOR TABLE &1;

   SELECT &2 FROM &1;

   PRINT;

   END;

   SELECT &2 FROM &1 WHERE &3;

   PRINT;

   END;

   COMMIT WORK;

   :wq MyFile

   isql=> SET ECHO ON; SET CONTINUE ON;



   These SET options affect command file processing as follows:

   All commands and error messages are displayed.  Processing

   continues if an error is encountered.



   isql=> START MyFile (PurchDB.Inventory,    "PartNumber,QtyOnHand",

   > "QtyOnHand <100");



   /*This file updates statistics of table &1

   and does several SELECT operations.*/



   UPDATE STATSTICS FOR TABLE &1;



   UPDATE STATSTICS FOR TABLE PurchDB.Inventory;

                 |

   Unexpected keyword.  (DBERR 1006)

   SELECT &2 FROM &1;



   First group of selected rows of query result are   displayed.




   PRINT;



   Number of rows selected is 20.



   END;

   SELECT &2 FROM &1 WHERE &3;



   First group of data rows of query result are displayed.



   PRINT;



   Number of rows selected is 20.



   END;

   COMMIT WORK;

   isql=> SET ECHO OFF; SET CONTINUE OFF;



   These SET options affect command file processing as follows:

   Only error messages are displayed.  Processing terminates if an

   error is encountered.



   isql=> START MyFile (PurchDB.Parts,*,SalesPrice> 1000);



   UPDATE STATSTICS FOR TABLE PurchDB.Parts;

                    |

   Unexpected keyword.  (DBERR 1006)

   Command file execution terminated.  (DBERR 60)

   Last command:

   UPDATE STATSTICS FOR TABLE &1;

   isql=>
Feedback to webmaster