SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
D-51
Examples—DETAIL
Examples—DETAIL
This example specifies a report in the format shown:
>> SET LIST_COUNT 0;
>> SELECT * FROM SALES.CUSTOMER ORDER BY CUSTNUM;
S> DETAIL CUSTNUM HEADING "Account",
+> CUSTNAME AS A20 HEADING "Name" CENTER,
+> CONCAT (CITY STRIP, ", ", STATE)
+> HEADING "Location" CENTER,
+> TAB 60, IF CREDIT = "A1" THEN ("***" );
Some sample lines of this report are:
Account Name Location
------- -------------------- --------------------------
21 CENTRAL UNIVERSITY PHILADELPHIA, PENNSYLVANIA ***
123 BROWN MEDICAL CO SAN FRANCISCO, CALIFORNIA
This example specifies a report in the format shown:
>> SELECT FIRST_NAME,LAST_NAME,DEPTNAME,MANAGER,AVG (SALARY)
+> FROM PERSNL.EMPLOYEE E, PERSNL.DEPT D
+> WHERE D.DEPTNUM = E.DEPTNUM
+> GROUP BY FIRST_NAME, LAST_NAME, DEPTNAME, MANAGER;
S> DETAIL DEPTNAME AS A20 HEADING "Dept." NAME DN,
+> CONCAT (FIRST_NAME STRIP, SPACE 1, LAST_NAME) AS A18
+> HEADING "Manager", COL 5 HEADING "Avg. Salary" NAME AVSAL;
Some sample lines of this report are:
Dept. Manager Avg. Salary
-------------------- ------------------ -------------------
ASIA SALES SHERRIE WONG 45835.00
ENGINEERING ERIC BROWN 35000.00
MARKETING JACK RAYMOND 30166.67
This example demonstrates usage of SKIP to print a report vertically:
>> SET LIST_COUNT 0;
>> SET STYLE HEADINGS OFF,
>> SET LAYOUT PAGE_LENGTH ALL;
>> SELECT CUSTNAME, STREET, CITY, STATE, POSTCODE
+> FROM SALES.CUSTOMER
+> ORDER BY STATE, POSTCODE;
S> DETAIL PAGE,
+> CUSTNAME, SKIP 1,
+> STREET, SKIP 1,
+> CONCAT (CITY STRIP, ",", STATE STRIP,
+> " ", POSTCODE);
+> LIST NEXT 1;