HPlogo ALLBASE/ISQL Reference Manual: HP 9000 Computer Systems > Chapter 2 Getting Started with ISQL

Handling Errors

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Several types of errors can occur while you are using ISQL:

  • Command errors.

  • DBEnvironment errors.

  • Unexpected ISQL or DBEnvironment termination.

Usually, you see an error message when an error occurs. Error messages are taken from the message catalog. The name of the default catalog is /usr/lib/nls/n-computer/hpsqlcat. If you are a native language user, the catalog's name is /usr/lib/nls/$LANG/hpsqlcat, where $LANG is the current language. If this catalog is not available, ALLBASE/SQL uses the default catalog instead. Refer to the ALLBASE/SQL Message Manual for information on interpreting error and warning messages and suggestions on correcting exception conditions. You can also use the HELP command to obtain information on command use and structure if a command error occurs.

Command Errors

Commands may contain either syntax or semantic errors. Syntax errors involve erroneous command structure, as when a required parenthesis or keyword is omitted. Semantic errors involve erroneous information, as when the name of a table is misspelled.

When you submit an ISQL or SQL command from the terminal and it contains errors, you can recall it from the command history buffer, correct it, then resubmit it. For example:

   isql=> UPDATE STATSTICS FOR TABLE PurchDB.Parts;



   UPDATE STATSTICS FOR TABLE PurchDB.Parts;

           |

   Unexpected keyword.  (DBERR 1006)

   isql=> RECALL HISTORY 1;



   UPDATE STATSTICS FOR TABLE PurchDB.Parts;

   isql=> CHANGE /STATS/STATIS/;



   UPDATE STATISTICS FOR TABLE PurchDB.Parts;

  

   isql=> START;

   isql=>

When you are submitting commands from a command file, the CONTINUE option of the SET command determines what ISQL does when it encounters an erroneous command. If CONTINUE is ON, ISQL continues processing any subsequent commands in the command file. If CONTINUE is OFF, ISQL discontinues processing commands from the file and displays the input prompt.

When you submit commands from the command buffer, ISQL continues processing any subsequent commands in the buffer when it encounters an erroneous command.

When the EXIT_ON_DBERR option of the SET command is ON, ISQL will terminate immediately if an SQL error occurs. The EXIT_ON_DBERR option has precedence over the CONTINUE option.

DBEnvironment Errors

Some errors may be caused by the following conditions in the DBEnvironment:

  • A DBEnvironment is not started yet.

  • Resources are insufficient.

  • A deadlock has occurred.

Refer to the ALLBASE/SQL Database Administration Guide information on handling these kinds of errors.

Unexpected ISQL or DBEnvironment Termination

If ISQL stops running or a STOP DBE command is issued while you are submitting SQL statements, work done by any transactions in progress at termination is automatically undone when the DBEnvironment is next started up. Only work up to the last COMMIT WORK executed prior to termination permanently affects the DBEnvironment.

Checking the Exit Status

When running ISQL in a script, you can check the $? exit status to ensure that ISQL completed successfully. ISQL sets the exit status to the number of SQL errors encountered. If an SQL error is not encountered, ISQL sets the exit status to 0. The exit status may contain a value in the range 0 - 255.

Feedback to webmaster