SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
1-1
1 Introduction
NonStop SQL/MX is a relational database management system (RDBMS) that uses
SQL:1999 to define and manipulate data in an SQL/MX database. SQL-92 is the
current ANSI version of SQL (structured query language).
To access data, you execute SQL statements interactively by using the SQL/MX
conversational interface (MXCI) or programmatically by embedding SQL statements in
a host program written in ANSI C/C++ or COBOL.
When you embed SQL statements and declarations in a 3GL program, you can access
a database by using SQL statements and then use 3GL statements to process and
manipulate the data. Embedding SQL in programs enables you to build real-world
applications that manipulate data within an SQL/MX database.
This section provides these overviews:
•
Referencing Database Object Names on page 1-1
•
Embedding SQL Statements on page 1-2
•
Declaring and Using Host Variables on page 1-2
•
Using DML Statements to Manipulate Data on page 1-4
•
Declaring and Using Static SQL Cursors on page 1-5
•
Using DML Statements With Rowsets on page 1-7
•
Processing Exception Conditions on page 1-9
•
Ensuring Data Consistency on page 1-10
•
Using Dynamic SQL on page 1-6
•
Compiling and Building an Application on page 11
Referencing Database Object Names
NonStop SQL/MX Release 2.x
In SQL/MX Release 2.x, all SQL/MX database objects use three-part ANSI names of
the form catalog.schema.name. NonStop SQL/MX supports these database
objects: base table, index, DDL lock, SQLMP alias, stored procedure, trigger, trigger
temporary table, view, partition, and constraints (check constraint, not null constraint,
primary key constraint, unique constraint, and referential constraint). The MPALIAS
table is not needed and not used in SQL/MX Release 2.x.
NonStop SQL/MX Release 1.x
In releases prior to SQL/MX Release 2.x, to enable the use of ANSI logical names in
an SQL/MP table, a user table name MPALIAS is created at installation time to store
mappings from logical object names to physical Guardian locations. Use the CREATE
Note. NonStop SQL/MX does not support embedded SQL statements in a DLL or private SRL.