1. Trang chủ
  2. » Công Nghệ Thông Tin

Oracle PL/SQL for dummies phần 1 pps

44 558 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 44
Dung lượng 825,31 KB

Nội dung

[...]... 2/26/2006 452 3 /17 /2006 453 6/5/2006 11 12 Part I: Basic PL/SQL Concepts Table 1- 5 A Sample Relational PURCH_ORDER_DTL Table PO_Nbr Line_Nbr Item Qty Price 450 1 Hammer 1 $10 .00 4 51 1 Screwdriver 1 $8.00 4 51 2 Pliers 2 $6.50 4 51 3 Wrench 1 $7.00 452 1 Wrench 3 $7.00 452 2 Hammer 1 $10 .00 453 1 Pliers 1 $6.50 A purchase order can include many items Table 1- 5 shows that Purchase Order 4 51 includes three... Tables 1- 4 and 1- 5, the same data could be structured as shown in Table 1- 7 Table 1- 7 PURCH_ORDER Table (1NF Violation) PO_NBR DATE ITEM 1 QTY1 PRICE1 ITEM2 QTY2 PRICE2 450 12 -10 -06 Hammer 1 4 51 02-26-06 Screwdriver 1 $8.00 Pliers 2 $6.50 452 03 -17 -06 Wrench 3 $7.00 Hammer 2 $10 .00 453 06-05-06 Pliers 1 $6.50 $10 .00 Although this table looks okay, what if a third item were associated with PO 4 51? Using... restructured into two separate tables (DEPT and EMP), as shown in Tables 1- 2 and 1- 3 Table 1- 2 A Sample Relational DEPT Table DeptNo DeptName 10 Marketing 20 Purchasing Chapter 1: PL/SQL and Your Database Table 1- 3 A Sample Relational EMP Table EmpNo EName DeptNo 10 1 Abigail 10 10 2 Bob 20 10 3 Carolyn 10 10 4 Doug 20 10 5 Evelyn 10 By using this structure, you can examine the EMP table to find out that... in PL/SQL Code 11 1 Adding User-Defined Exceptions 11 4 Assigning a code to a user-defined exception 11 5 Including error messages in user-defined exceptions 11 6 Propagation of Exceptions 11 8 Seeing propagation of exceptions in action 11 8 Handling exceptions without halting the program 12 2 Avoiding exceptions raised in declaration part and exception handler 12 4... has a number and a name You could organize this information as shown in Table 1- 1 Table 1- 1 Sample Employee Information EmpNo Ename DeptNo DeptName 10 1 Abigail 10 Marketing 10 2 Bob 20 Purchasing 10 3 Carolyn 10 Marketing 10 4 Doug 20 Purchasing 10 5 Evelyn 10 Marketing If you structure your data this way and make certain changes to it, you’ll have problems For example, deleting all the employees in the Purchasing... PURCH_ORDER_DETAIL Table (2NF Violation) PO_NBR LINE DATE ITEM QTY PRICE 450 1 12 -10 -06 Hammer 1 $10 .00 4 51 1 02-26-06 Screwdriver 1 $8.00 4 51 2 02-26-06 Pliers 2 $6.50 452 1 03 -17 -06 Wrench 3 $7.00 452 2 03 -17 -06 Hammer 2 $10 .00 453 1 06-05-06 Pliers 1 $6.50 In this structure, the PURCH_ORDER_DETAIL table uses both PO_NBR and LINE for the primary key But DATE is dependent only on the PO_NBR (when you know... 17 The difference between SQL and PL/SQL 18 What’s new in Oracle SQL and PL/SQL? 18 What Is PL/SQL Good For? 19 Using database triggers .19 Scripting with speed 20 Keeping code server-side 20 Programming for Oracle Developer 21 Chapter 2: The PL/SQL Environment 23 Setting Up an Oracle Environment .23 Hardware... global variables . 210 Indent carefully 210 Be careful with capitalization 211 Use generic variable datatype declarations 211 Limit line length 213 Use explicit data conversion for dates 213 Use synonyms 213 Developing SQL Code Consistently 214 Using a new line 214 Using explicit column lists 214 Prefixing (and suffixing)... Defining cursors in the local PL/SQL block 13 8 Defining cursors in the package body .13 9 Defining cursors in the package spec 14 0 xi xii Oracle PL/SQL For Dummies Being Explicitly Smart with Implicit Cursors 14 2 Retrieving a single row: The basic syntax .14 2 Handling exceptions in implicit cursors 14 3 Returning an implicit cursor into a record .14 3 Accessing Status Info... 12 6 Chapter 6: PL/SQL and SQL Working Together 12 7 Cursors: What They Are and How to Use Them 12 8 Returning more than one piece of information 12 9 Looping through multiple records 13 2 Placing cursors in nested loops .13 3 Passing parameters to cursors .13 4 Knowing Where to Declare Cursors 13 7 Defining cursors in the header of the program unit 13 8 . Dorsey Oracle ® PL/SQL FOR DUMmIES ‰ 01_ 599577 ffirs.qxp 5 /1/ 06 12 :08 PM Page i 01_ 599577 ffirs.qxp 5 /1/ 06 12 :08 PM Page iv by Michael Rosenblum and Dr. Paul Dorsey Oracle ® PL/SQL FOR DUMmIES ‰ 01_ 599577. and their influences 18 9 Setting Naming Standards for Common Code Elements 18 9 Basic objects 19 0 Variables 19 1 Oracle PL/SQL For Dummies xii 02_599577 ftoc.qxp 5 /1/ 06 12 :09 PM Page xii Program. between SQL and PL/SQL 18 What’s new in Oracle SQL and PL/SQL? 18 What Is PL/SQL Good For? 19 Using database triggers 19 Scripting with speed 20 Keeping code server-side 20 Programming for Oracle Developer

Ngày đăng: 08/08/2014, 20:21

TỪ KHÓA LIÊN QUAN