SQL Programming Manual for TAL
Examples of Static NonStop SQL Programs
HP NonStop SQL Programming Manual for TAL—527887-001
B-11
Date-Time Program
•
Insert a new project name, start date, end date, and wait time.
•
Add more wait time to a project by updating the WAIT_TIME column in the
PROJECTS table. The original dates in the START_DATE and END_DATE
columns in the PROJECTS table remain unchanged.
•
Print a report showing the original dates and the new dates. The report function
computes the new dates by adding wait time to both the start date and end date.
TALDT also shows these error handling techniques:
•
A temporary variable to save the SQLCODE value within an error handling routine,
which allows the program to use the value after handling the error
•
The temporary disabling of WHENEVER SQLERROR checking to avoid a possible
infinite loop if an error should occur in the error handling routine
•
The temporary disabling of WHENEVER NOT FOUND checking for a cursor
FETCH operation
•
The use of the SQLCODE value to make processing decisions and to make certain
operations conditional upon the absence of any errors
Figure B-2
shows a sample run of TALDT. The object file is TALDTO. The data entered
by the user is shown in bold type. Figure B-2
also includes SQLCI sessions, displaying
the contents of the PROJECTS table before and after the program updates the table.