Skip to Content
Oracle PL/SQL Programming: A Developer's Workbook
book

Oracle PL/SQL Programming: A Developer's Workbook

by Steven Feuerstein, Andrew Odewahn
May 2000
Intermediate to advanced
594 pages
11h 32m
English
O'Reilly Media, Inc.
Content preview from Oracle PL/SQL Programming: A Developer's Workbook

Expert

7-33.

The questions in this section refer to the following tables and types, which implement a rudimentary purchase-order system. The ORDERS table stores a sequential order number along with a short description. The lines of the purchase order are stored in the nested table column ORDER_DETAIL. The TAX_CODES column records the tax codes that apply to the purchase order.

Write a SQL script to create the following structures:

SQL> DESCRIBE orders;
 Name                            Null?    Type
 ------------------------------- -------- ----
 ORDER_NO                        NOT NULL NUMBER
 ORDER_DESC                               VARCHAR2(30)
 ORDER_DETAIL                             ORDER_DETAIL_T
 TAX_CODES                                TAX_CODE_T

SQL> DESCRIBE order_detail_t;
 order_detail_t TABLE OF DETAIL_T
 Name                            Null?    Type
 ------------------------------- -------- ----
 DETAIL_NO                                NUMBER
 DETAIL_DESC                              VARCHAR2(30)
 DETAIL_PRICE                             NUMBER

SQL> DESCRIBE detail_t;
 Name                            Null?    Type
 ------------------------------- -------- ----
 DETAIL_NO                                NUMBER
 DETAIL_DESC                              VARCHAR2(30)
 DETAIL_PRICE                             NUMBER

SQL> DESCRIBE tax_code_t;
 tax_code_t TABLE OF TAX_CODE_DETAIL_T
 Name                            Null?    Type
 ------------------------------- -------- ----
 TAX_CODE                                 VARCHAR2(10)

SQL> DESCRIBE tax_code_detail_t;
 Name                            Null?    Type
 ------------------------------- -------- ----
 TAX_CODE                                 VARCHAR2(10)

SQL> DESCRIBE order_detail;
 Name                            Null?    Type
 ------------------------------- -------- ----
 DETAIL_NO                                NUMBER
 DETAIL_DESC                              VARCHAR2(30)
 DETAIL_PRICE                             NUMBER

SQL> DESCRIBE order_tax_codes;
 Name                            Null?    Type
 ------------------------------- -------- ----
 TAX_CODE                                 VARCHAR2(10)

7-34.

Now that we have the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Database 11g PL/SQL Programming Workbook

Oracle Database 11g PL/SQL Programming Workbook

Michael McLaughlin, John Harper

Publisher Resources

ISBN: 9781449324070Supplemental ContentErrata Page