SQL Programming Manual for Pascal
HP NonStop SQL Programming Manual for Pascal—528614-001
1-1
1 Introduction
NonStop SQL is the Tandem relational database management system that uses SQL
to define and manipulate data in a NonStop SQL database. Because NonStop SQL is
integrated with other Tandem software products, you can execute SQL statements
interactively or programmatically.
Using the SQL conversational interface (SQLCI), you can enter SQL statements and
directives interactively from a terminal or from an OBEY command file. NonStop SQL
compiles and executes each statement immediately and then displays a response on
your terminal. Using SQLCI, you can also test SQL statements before you embed and
compile them in a program.
Using the programmatic interface, you can embed SQL statements and directives in a
C, COBOL85, Pascal, or TAL host language program. You compile the embedded SQL
statements using the SQL compiler and the host language statements using the host
language compiler. The SQL statements execute when the object file runs.
NonStop SQL also provides system library procedures you can call from a program to
perform various SQL functions (for example, to get error and statistics information after
executing an SQL statement).
Benefits of Using Embedded SQL
Using embedded SQL statements has these advantages:
•
High-level language for accessing a database. Using SQL statements, you code a
request to access a database, and NonStop SQL chooses an efficient method to
perform the request.
•
Insulation against database changes. If a database administrator modifies a
database (for example, adds columns to a table), the logic of your program is not
affected.
•
Use of Pascal for processing data. You can use SQL statements to retrieve data
from a database or to insert data into a database, and you can use Pascal
statements to process and manipulate the data.
•
NonStop SQL system support for data consistency. When you use audited tables
and views, NonStop SQL maintains data consistency with its locking facility and by
using the HP NonStop Transaction Management Facility (TMF).
Developing a Program With Embedded SQL
A Pascal program that contains embedded SQL statements can use both static and
dynamic SQL operations. A static SQL operation processes SQL statements that you
embed in the source code, while a dynamic SQL operation constructs, compiles, and
executes an SQL statement that is unknown or incomplete until the program is running.