Expert
8-33. | All the questions in this section refer to the tables and user-defined datatypes (UDTs) for 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. As the first exercise in this section, write a SQL script to create the following structures: SQL> DESC orders Name Null? Type ------------------------------- -------- ---- ORDER_NO NOT NULL NUMBER ORDER_DESC VARCHAR2(30) ORDER_DETAIL ORDER_DETAIL_T TAX_CODES TAX_CODE_T SQL> DESC order_detail_t order_detail_t VARRAY(10) OF DETAIL_T Name Null? Type ------------------------------- -------- ---- DETAIL_NO NUMBER DETAIL_DESC VARCHAR2(30) DETAIL_PRICE NUMBER SQL> DESC order_detail_nt order_detail_nt TABLE OF DETAIL_T Name Null? Type ------------------------------- -------- ---- DETAIL_NO NUMBER DETAIL_DESC VARCHAR2(30) DETAIL_PRICE NUMBER SQL> DESC detail_t Name Null? Type ------------------------------- -------- ---- DETAIL_NO NUMBER DETAIL_DESC VARCHAR2(30) DETAIL_PRICE NUMBER SQL> DESC tax_code_t tax_code_t VARRAY(2) OF TAX_CODE_DETAIL_T Name Null? Type ------------------------------- -------- ---- TAX_CODE VARCHAR2(10) SQL> DESC tax_code_detail_t Name Null? Type ------------------------------- -------- ---- TAX_CODE VARCHAR2(10) |
8-34. | Why were order_detail_t (a variable array) and order_detail_nt (a nested ... |
Get Oracle PL/SQL Programming: A Developer's Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.