SQL/MX Report Writer Guide
Selecting Data for a Report
HP NonStop SQL/MX Report Writer Guide—527194-002
3-26
Using Views
This SELPREP file contains this PREPARE command:
PREPARE SELCUSTINFO FROM
' SELECT * FROM CUSTOMER C, '
' ORDERS R, '
' ODETAIL OD, '
' PARTS P '
' WHERE C.CUSTNUM = R.CUSTNUM '
' AND R.ORDERNUM = OD.ORDERNUM '
' AND OD.PARTNUM = P.PARTNUM '
' AND C.CUSTNUM = ? '
' AND SALESREP = ?';
The SELECT command contains two unnamed parameters to be given values through
an EXECUTE command.
EXECUTE SELCUSTINFO USING 21, 223;
LIST ALL;
EXECUTE SELCUSTINFO USING 123, 226;
LIST ALL;
.
.
EXECUTE SELCUSTINFO USING 7777, 220;
LIST ALL;
To prepare the SELECT command enter:
>> OBEY SELPREP;
( PREPARE command is displayed here.)
.
.
--- SQL command prepared.
To print a report, use the LOG command to log your session and then print the log file
through OSS. For more information, see the Open System Services User’s Guide.
Using Views
A view is a logical table derived by projecting a subset of columns or selecting a subset
of rows from one or more tables or from another view. You specify the definition of the
view by using a SELECT command.
By defining a view, you can provide a way in which other users can retrieve values
without specifying complicated queries. For example, the following commands define a
view named CUSTORD to be used to print invoices and reports that summarize order