SQL/MP Programming Manual for COBOL85
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
4-1
4 Data Retrieval and Modification
This section describes how to access data in a NonStop SQL/MP database by using
the Data Manipulation Language (DML) statements in a COBOL program.
Table 4-1 provides some guidelines for using these statements.
Table 4-1. SQL/MP Statements for Data Retrieval and Modification
NonStop SQL/MP Statement Description
Single-Row SELECT statement Retrieves a single row of data from a table or
protection view and places the specified column
values in host variables. Use when you need to
retrieve only a single row.
SELECT statement with a cursor Retrieves a set of rows from a table or view, one row
at a time, and places the specified column values in
host variables. Use when you need to retrieve more
than one row.
INSERT statement Inserts one or more rows into a table or protection
view. Use for all INSERT operations.
UPDATE statement without a cursor Updates the values in one or more columns in a
single row or a set of rows of a table or protection
view. Use when you do not need to test a column
value in a row before you update the row.
UPDATE statement with a cursor Updates the values in one or more columns in a set
of rows, one row at a time. Use when you need to test
a column value in a row before you update the row.
DELETE statement without a cursor Deletes a single row or a set of rows from a table or
protection view. Use when you do not need to test a
column value in a row before you delete the row.
DELETE statement with a cursor Deletes a set of rows, one row at a time, from a table
or protection view. Use when you need to test a
column value in a row before you delete the row.
Note. Using a cursor can sometimes degrade a program’s performance. A cursor operation
requires three statements (OPEN, FETCH, and CLOSE), which increase the messages
between the file system and disk process. Therefore, consider not using a cursor if a single-row
SELECT statement is sufficient.