Danh mục

Oracle PLSQL Language- P18

Số trang: 50      Loại file: pdf      Dung lượng: 232.12 KB      Lượt xem: 11      Lượt tải: 0    
Thư viện của tui

Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu oracle plsql language- p18, công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Oracle PLSQL Language- P18 END; /* The total_cost function uses net_profit. */ FUNCTION total_cost (. . .) RETURN NUMBER IS BEGIN IF net_profit (. . .) < 0 THEN RETURN 0; ELSE RETURN . . .; END IF; END; BEGIN . . . END; Here are some rules to remember concerning forward declarations: q You cannot make forward declarations of a variable or cursor. This technique works only with modules (procedures and functions). q The definition for a forwardly-declared program must be contained in the declaration section of the same PL/SQL block (anonymous block, procedure, function, or package) in which you code the forward declaration. In some situations, you absolutely require forward declarations; in most situations, they just help make your code more readable and presentable. As with every other advanced or unusual feature of the PL/SQL language, use forward declarations only when you really need the functionality. Otherwise, the declarations simply add to the clutter of your program, which is the last thing you want. Previous: 15.8 Module Oracle PL/SQL Next: 15.10 Go Forth and Overloading Programming, 2nd Edition Modularize! 15.8 Module Overloading Book Index 15.10 Go Forth and Modularize! The Oracle Library Navigation Copyright (c) 2000 OReilly & Associates. All rights reserved.Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Previous: 15.9 Forward Chapter 15 Next: 16. Packages Declarations Procedures and Functions 15.10 Go Forth and Modularize! As the PL/SQL language and Oracle tools mature, you will find that you are being asked to implement increasingly complex applications with this technology. To be quite frank, you dont have much of a chance of success in implementing such large-scale projects without an intimate familiarity with the modularization techniques available in PL/SQL. While this book could not possibly provide a full treatment of modularization in PL/SQL, it should give you some solid pointers and a foundation from which to work. There is still much more for you to learn -- the full capabilities of packages, the awesome range of package extensions Oracle Corporation now provides with the tools and database, and the various options for code reusability -- and more. Behind all of that technology, however, you must develop an instinct, a sixth sense, for modularization. Develop a deep and abiding allergy to code redundancy and the hardcoding of values and formulas. Apply a fanatics devotion to the modular construction of true black boxes which easily plug-and-play in and across applications. You will find yourself spending more time in the design phase and less time in debug mode. Your programs will be more readable and maintainable. They will stand as elegant testimonies to your intellectual integrity. You will be the most popular kid in your class and ... but enough already. I am sure you are properly motivated. Go forth and modularize! Previous: 15.9 Forward Oracle PL/SQL Next: 16. Packages Declarations Programming, 2nd Edition 15.9 Forward Declarations Book Index 16. Packages The Oracle Library NavigationPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Copyright (c) 2000 OReilly & Associates. All rights reserved.Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Previous: 15.10 Go Forth Chapter 16 Next: 16.2 Overview of and Modularize! Package Structure 16. Packages Contents: The Benefits of Packages Overview of Package Structure The Package Specification The Package Body Package Data Package Initialization A package is a collection of PL/SQL objects that are packaged or grouped together within a special BEGIN-END syntax, a kind of meta-block. Here is a partial list of the kinds of objects you can place in a package: q Cursors q Variables (scalars, records, tables, etc.) q Constants q Exception names q PL/SQL table and record TYPE statements q Procedures q Functions Packages are among the least understood and most underutilized features of PL/SQL. That is a shame, because the package structure is also one of the most useful constructs for building well- desi ...

Tài liệu được xem nhiều: