Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
ALLBASE/SQL Pascal Application Programming Guide: HP 9000 Computer Systems > Chapter 3 Embedding SQL Commands

Implicit Status Checking

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

You can use the WHENEVER command, as at 6 in Figure 3-1, to have ALLBASE/SQL examine SQLCA values and cause a specific action to be taken. The WHENEVER command is a preprocessor directive that specifies the action to be taken if an error or warning condition occurs during each execution of the SQL command:

   EXEC SQL WHENEVER SQLERROR CONTINUE;

                     |        |

                     |        |

                     |        |

                     |        the action

                     |

                     the condition

Each WHENEVER command affects all ALLBASE/SQL commands that follow it in the source listing until another WHENEVER command is encountered.

If execution of the COMMIT WORK RELEASE command at 7 or the SELECT command at 8 causes an error condition, ALLBASE/SQL takes no special action. This occurs because the WHENEVER command shown above precedes the COMMIT WORK RELEASE and SELECT commands in the source listing.

The WHENEVER SQLERROR command at 6 turns off the implicit status checking of the WHENEVER SQLERROR command that appears earlier in the source listing:

   EXEC SQL WHENEVER SQLERROR goto 1000;

This WHENEVER command specifies where to pass control when an error occurs during execution of the CONNECT, BEGIN WORK, or COMMIT WORK commands.

Although you can use a WHENEVER command to have ALLBASE/SQL examine the values in certain fields of the SQLCA, you can also examine the values yourself, as discussed under "Explicit Status Checking" later in this chapter.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.