SQL Programming Manual for TAL

HP NonStop SQL Programming Manual for TAL527887-001
1-1
1 Introduction
The NonStop SQL relational database management system (RDBMS) uses the
structured query language (SQL) to define and manipulate data in a NonStop SQL
database. Because NonStop SQL is integrated with other HP NonStop 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 an OBEY command file. NonStop SQL
compiles and executes the statement immediately and then issues a response at your
terminal. Using SQLCI, you can also test programmatic 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 program. You compile the host language statements
using the host language compiler and the embedded SQL statements using the SQL
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).
This manual describes the TAL programmatic interface to NonStop SQL. It shows you
how to embed SQL statements and directives in a TAL program and how to call the
SQL system library procedures from a TAL program.
Why Use Embedded SQL Statements?
Using embedded SQL statements in a TAL program to access a NonStop SQL
database has these advantages:
High-level language for accessing a database. Using SQL statements, you code a
request to access a database, and NonStop SQL determines the most 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 TAL for processing data. You can use SQL statements to retrieve data from
a database or insert data into a database, and you can use TAL statements to
process and manipulate the data.
System support for data consistency. When you use audited tables and views, the
system maintains data consistency with the locking facility and the HP NonStop
Transaction Manangement Facility (TMF).