Download presentation
Presentation is loading. Please wait.
Published byColin Clarke Modified over 9 years ago
1
1 R. Ching, Ph.D. MIS Area California State University, Sacramento Week 2 February 1 PL/SQLPL/SQL Creating a FormCreating a Form
2
2 R. Ching, Ph.D. MIS Area California State University, Sacramento Coding Standards Element names (functions, objects, variables, etc.): 30- character maximum lengthElement names (functions, objects, variables, etc.): 30- character maximum length Uppercase letters for keywordsUppercase letters for keywords Lowercase letters for user-defined elementsLowercase letters for user-defined elements 80 characters per line80 characters per line –One command per line CommentsComments –Header comments: /* comment */ –Inline comments: -- comment Prefix object namesPrefix object names
3
3 R. Ching, Ph.D. MIS Area California State University, Sacramento PL/SQL Processing Language/SQL Procedural processing language for various Oracle tools:Procedural processing language for various Oracle tools: –Forms –Reports –Graphics Character setCharacter set –Alphabetic, numeric and special characters –Arithmetic and relational operators –Others (;,., :=, | |, --, /* */)
4
4 R. Ching, Ph.D. MIS Area California State University, Sacramento PL/SQL Block Declaration Section Executable Section Exception Section Exception Section Declares variables and constants (optional). Procedural programming Defines the exception handlers invoked for both predefined and user-defined exceptions (optional).
5
5 R. Ching, Ph.D. MIS Area California State University, Sacramento PL/SQL Block Declare section Exception section Executable section
6
6 R. Ching, Ph.D. MIS Area California State University, Sacramento PL/SQL Declaration Section Declare variable and constant names and typesDeclare variable and constant names and types Data typesData types –Character (varchar2) –Numeric –Date –Boolean
7
7 R. Ching, Ph.D. MIS Area California State University, Sacramento Variable and Constant Declaration Defines the existence of all variables used in the procedure... declare variable-name data-type; constant-name := value;Defines the existence of all variables used in the procedure... declare variable-name data-type; constant-name := value; –For example... declare line_count number; product_request varchar2(10); max_count := 20; Data types Constant
8
8 R. Ching, Ph.D. MIS Area California State University, Sacramento For Example... declare product_request varchar2(3); product_descrip varchar(30); price real; cursor product is select product_description, product_msrp from products where manufacturer_code = product_request;...begin; open product; loop fetch product into product_descrip, price;... close product; Order of variables must match the order in the select Query assigned to “product”
9
9 R. Ching, Ph.D. MIS Area California State University, Sacramento Executable Section Types of statementsTypes of statements –Assignment –Flow-of-control –SQL –Cursor All statements must be terminated by a semi-colon (;)All statements must be terminated by a semi-colon (;)
10
10 R. Ching, Ph.D. MIS Area California State University, Sacramento Exception Section Instructs PL/SQL how to handle particular exceptions exception when exception-name then PL/SQL statements; when exception-name then PL/SQL statements; end;Instructs PL/SQL how to handle particular exceptions exception when exception-name then PL/SQL statements; when exception-name then PL/SQL statements; end;
11
11 R. Ching, Ph.D. MIS Area California State University, Sacramento Exception Names Predefined - Defined in OraclePredefined - Defined in Oracle –DUP_VAL_ON_INDEX (duplicate value on a unique index) –INVALID_NUMBER –NO_DATA_FOUND (no rows returned) –TOO_MANY_ROWS (multiple rows returned) –VALUE_ERROR User-defined - Defined in the declarations as an exception (data type).User-defined - Defined in the declarations as an exception (data type).
12
12 R. Ching, Ph.D. MIS Area California State University, Sacramento Oracle Developer Oracle Developer Forms (interactive)Forms (interactive) –Presenting information and entering data online Reports (reporting)Reports (reporting) –Page-oriented display of information Graphics (charts)Graphics (charts) –Graphic representation of data
13
13 R. Ching, Ph.D. MIS Area California State University, Sacramento
14
14 R. Ching, Ph.D. MIS Area California State University, Sacramento Forms Designer Four major componentsFour major components –Object Navigator –Layout editor –Property palette (sheet) –PL/SQL editor
15
15 R. Ching, Ph.D. MIS Area California State University, Sacramento Object Navigator Forms module with various objects Modules Modules: FormsForms MenuMenu LibrariesLibraries Built-in PackagesBuilt-in Packages Database ObjectsDatabase Objects
16
16 R. Ching, Ph.D. MIS Area California State University, Sacramento Toolbar Object type Hierarchy Specifies the order in which objects and items are executed Menus
17
17 R. Ching, Ph.D. MIS Area California State University, Sacramento Window and Canvas Objects Window Canvas-View Interface Item Boilerplate objects (lines, images, boxes, etc.) Canvas-View Four types of canvas-views: Content, Stacked, Horizontal Toolbar, and Vertical Toolbar
18
18 R. Ching, Ph.D. MIS Area California State University, Sacramento Window-Canvas-Block-Items Relationship Window Canvas-View Block Items PL/SQL Menu object
19
19 R. Ching, Ph.D. MIS Area California State University, Sacramento Layout Editor Tool palette Tool bar Layout work area Rulers
20
20 R. Ching, Ph.D. MIS Area California State University, Sacramento Property Palette Property Palette Properties of the canvas Set an object’s attributes
21
21 R. Ching, Ph.D. MIS Area California State University, Sacramento Triggers TriggerTrigger
22
22 R. Ching, Ph.D. MIS Area California State University, Sacramento PL/SQL Editor Trigger List of triggers PL/SQL code
23
23 R. Ching, Ph.D. MIS Area California State University, Sacramento Inheriting Properties Stereos to Go! Enter Exit View Report Graph Exit Class Properties
24
24 R. Ching, Ph.D. MIS Area California State University, Sacramento Creating a Property Class Create a Property Class object in the parent moduleCreate a Property Class object in the parent module Add the property and its valuesAdd the property and its values Select the object in the childSelect the object in the child –Under Subclass Information, specify the property class
25
25 R. Ching, Ph.D. MIS Area California State University, Sacramento Create the Property Class in the Parent
26
26 R. Ching, Ph.D. MIS Area California State University, Sacramento Add the Properties to the Class Added to the class
27
27 R. Ching, Ph.D. MIS Area California State University, Sacramento Inherit the Property Class in the Child Select the object and its Property Palette Select Subclass Information Specify the object or property class name and its form module Parent module Property class
28
28 R. Ching, Ph.D. MIS Area California State University, Sacramento Menus Menus Menu items File Menu
29
29 R. Ching, Ph.D. MIS Area California State University, Sacramento Menu Module Menu module Menu object Menu items Five Simple Steps: Create the menu module Add the menu objects Add the menu items to the menu objects Program the items in PL/SQL Attach the menu module to the form module
30
30 R. Ching, Ph.D. MIS Area California State University, Sacramento Why Multiple Forms? Build more functional units (forms)Build more functional units (forms) –Design the form to support a narrow scope of functions –Reduce the complexity of a single form Reduce the time to develop and implement an applicationReduce the time to develop and implement an application Enhance maintainability of the application (plug-and-play!)Enhance maintainability of the application (plug-and-play!) Promotes reusability or cloningPromotes reusability or cloning
31
31 R. Ching, Ph.D. MIS Area California State University, Sacramento Calling and Called Forms CallingCalled The calling form module transfers control (calls, opens) to the called formThe calling form module transfers control (calls, opens) to the called form CALL_FORM (form-module-name,display,switch-menu) –Calling form remains present behind the called form –Called module assumes the calling module’s menu module
32
32 R. Ching, Ph.D. MIS Area California State University, Sacramento Calling and Called Forms Upon exit of the called form, control returns to the calling formmoduleUpon exit of the called form, control returns to the calling formmoduleEXIT_FORM CallingCalled
33
33 R. Ching, Ph.D. MIS Area California State University, Sacramento Calling a Form Module Create or select an item (i.e., push button) on the canvas or in the menu moduleCreate or select an item (i.e., push button) on the canvas or in the menu module Program the item in the PL/SQL EditorProgram the item in the PL/SQL Editor –Select a trigger that will activate the procedure –Enter the CALL_FORM statement –Compile the code Test the form moduleTest the form module
34
34 R. Ching, Ph.D. MIS Area California State University, Sacramento Causes Oracle Forms to clear the calling form from the screen before drawing the called form. HIDE is the default parameter. (NO_HIDE) Form module name Causes Oracle Forms to keep the default menu application of the calling form active for the called form. (REPLACE) In the PL/SQL Editor
35
35 R. Ching, Ph.D. MIS Area California State University, Sacramento NEW_FORM NEW_FORM closes the calling formNEW_FORM closes the calling form Greeting Screen Main Menu QueryQuery NEW_FORM EXIT_FORM EXIT_FORM MenuMenu CALL_FORM
36
36 R. Ching, Ph.D. MIS Area California State University, Sacramento
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.