Tuesday, March 19, 2013

Oracle Exceptions


Exception:
In PL/SQL, a warning or error condition is called an exception. Exceptions can be internally defined (by the run-time system) or user defined.
Exception Types:
• Predefined Oracle Server (Implicitly Raised)
• Non predefined Oracle Server (Implicitly Raised)
• User-defined (Explicitly Raised)
Predefined Oracle Server
Predefined exceptions are used to detect and handle Oracle system errors that occur internally at program run time.
An internal exception is raised implicitly whenever your PL/SQL program violates an Oracle rule or exceeds a system-dependent limit. 

Exception
Raised when ...
ACCESS_INTO_NULL
Your program attempts to assign values to the attributes of an uninitialized (atomically null) object.
CASE_NOT_FOUND
None of the choices in the WHEN clauses of a CASE statement is selected, and there is no ELSE clause.
COLLECTION_IS_NULL
Your program attempts to apply collection methods other than EXISTS to an uninitialized (atomically null) nested table or varray, or the program attempts to assign values to the elements of an uninitialized nested table or varray.
CURSOR_ALREADY_OPEN
Your program attempts to open an already open cursor. A cursor must be closed before it can be reopened. A cursor FOR loop automatically opens the cursor to which it refers. So, your program cannot open that cursor inside the loop.
DUP_VAL_ON_INDEX
Your program attempts to store duplicate values in a database column that is constrained by a unique index.
INVALID_CURSOR
Your program attempts an illegal cursor operation such as closing an unopened cursor.
INVALID_NUMBER
In a SQL statement, the conversion of a character string into a number fails because the string does not represent a valid number. (In procedural statements, VALUE_ERROR is raised.) This exception is also raised when the LIMIT-clause expression in a bulk FETCH statement does not evaluate to a positive number.
LOGIN_DENIED
Your program attempts to log on to Oracle with an invalid username and/or password.
NO_DATA_FOUND
A SELECT INTO statement returns no rows, or your program references a deleted element in a nested table or an uninitialized element in an index-by table. SQL aggregate functions such as AVG and SUM always return a value or a null. So, a SELECT INTO statement that calls an aggregate function never raises NO_DATA_FOUND. The FETCH statement is expected to return no rows eventually, so when that happens, no exception is raised.
NOT_LOGGED_ON
Your program issues a database call without being connected to Oracle.
PROGRAM_ERROR
PL/SQL has an internal problem.
ROWTYPE_MISMATCH
The host cursor variable and PL/SQL cursor variable involved in an assignment have incompatible return types. For example, when an open host cursor variable is passed to a stored subprogram, the return types of the actual and formal parameters must be compatible.
SELF_IS_NULL
Your program attempts to call a MEMBER method on a null instance. That is, the built-in parameter SELF (which is always the first parameter passed to a MEMBER method) is null.
STORAGE_ERROR
PL/SQL runs out of memory or memory has been corrupted.
SUBSCRIPT_BEYOND_COUNT
Your program references a nested table or varray element using an index number larger than the number of elements in the collection.
SUBSCRIPT_OUTSIDE_LIMIT
Your program references a nested table or varray element using an index number (-1 for example) that is outside the legal range.
SYS_INVALID_ROWID
The conversion of a character string into a universal rowid fails because the character string does not represent a valid rowid.
TIMEOUT_ON_RESOURCE
A time-out occurs while Oracle is waiting for a resource.
TOO_MANY_ROWS
A SELECT INTO statement returns more than one row.
VALUE_ERROR
An arithmetic, conversion, truncation, or size-constraint error occurs. For example, when your program selects a column value into a character variable, if the value is longer than the declared length of the variable, PL/SQL aborts the assignment and raises VALUE_ERROR. In procedural statements, VALUE_ERROR is raised if the conversion of a character string into a number fails. (In SQL statements, INVALID_NUMBER is raised.)
ZERO_DIVIDE
Your program attempts to divide a number by zero.



Exception Examples:


set feedback off
set serveroutput on
 
create table foo (
  a  varchar2(10),
  b  varchar2(10),
  i  number
);
 
insert into foo values ('xxx','yyy',1);
insert into foo values ('zzz','aaa',1);
insert into foo values ('qqq','mmm',3);
 
commit;
 
declare
  l_a foo.a%type;
  l_b foo.b%type;
begin
  select a,b into l_a, l_b from foo where i=1;
  dbms_output.put_line('a: ' || l_a || ', b: ' || l_b);
exception 
  when too_many_rows then
    dbms_output.put_line('*** Exc: too many rows');
  when no_data_found then
    dbms_output.put_line('*** Exc: no data');
end;
/
 
declare
  l_a foo.a%type;
  l_b foo.b%type;
begin
  select a,b into l_a, l_b from foo where i=2;
  dbms_output.put_line('a: ' || l_a || ', b: ' || l_b);
exception 
  when too_many_rows then
    dbms_output.put_line('*** Exc: too many rows');
  when no_data_found then
    dbms_output.put_line('*** Exc: no data');
end;
/
 
declare
  l_a foo.a%type;
  l_b foo.b%type;
begin
  select a,b into l_a, l_b from foo where i=3;
  dbms_output.put_line('a: ' || l_a || ', b: ' || l_b);
exception 
  when too_many_rows then
    dbms_output.put_line('*** Exc: too many rows');
  when no_data_found then
    dbms_output.put_line('*** Exc: no data');
end;
/
 
drop table foo;



PL/SQL allows developers to define their own exceptions.User can define the error/exception programically based on the business rule. This is usually done on validating some values or parameters.Even exception can be given meaningful names.

There are 3 steps to handle the User exception

1. Define Exception

We need to define the exception before we raise and handle. User Exceptions are defined using keyword EXCEPTION in declaration section of the block.

The syntax is as follows

Code :
 <exception_name> EXCEPTION ;


2. Raise the Exception

Once the exceptions are defined , they need to be raised anywhere in the body depending upon predifined logic. User exceptions are raised using the keyword RAISE.

Syntax is as shown below

Code :
RAISE <exception_name>

3. Handle the Exception.

User exception are handled in the same way predefined exceptions are handled. They are handlded in exception block using WHEN .. THEN keyword

Syntax is as shown below

Code :
WHEN <exception_name> THEN
.....

Alternately we can give user defined error code and error message for the hadled excpetion. RAISE_APPLICATION_ERROR is used for this purpose.

Its syntax is as follows.

Code :
RAISE_APPLICATION_ERROR(<error_code>, <error_message>)

Here "error_code" should be in the range of (-20000,-20999) and "error_message" is the user defined error message for the user defined exception.

Friday, March 15, 2013

Autonomous transaction


Autonomous transaction
    
    An autonomous transaction is an independent transaction that is initiated by another transaction, and executes without interfering with the parent transaction. When an autonomous transaction is called, the originating transaction gets suspended. Control is returned when the autonomous transaction does a COMMIT or ROLLBACK.


A trigger or procedure can be marked as autonomous by declaring it as PRAGMA AUTONOMOUS_TRANSACTION. You may need to increase the TRANSACTIONS parameter to allow for the extra concurrent transactions.
The following types of PL/SQL blocks can be defined as autonomous transactions:
  • Stored procedures and functions.
  • Local procedures and functions defined in a PL/SQL declaration block.
  • Packaged procedures and functions.
  • Type methods.
  • Top-level anonymous blocks.
The easiest way to understand autonomous transactions is to see them in action. To do this, we create a test table and populate it with two rows. Notice that the data is not commited.

CREATE TABLE at_test (
  id           NUMBER       NOT NULL,
  description  VARCHAR2(50) NOT NULL
);

INSERT INTO at_test (id, description) VALUES (1, 'Description for 1');
INSERT INTO at_test (id, description) VALUES (2, 'Description for 2');

SELECT * FROM at_test;

        ID DESCRIPTION
---------- --------------------------------------------------
         1 Description for 1
         2 Description for 2

2 rows selected.

SQL>

Next, we insert another 8 rows using an anonymous block declared as an autonomous transaction, which contains a commit statement.

DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
  FOR i IN 3 .. 10 LOOP
    INSERT INTO at_test (id, description)
    VALUES (i, 'Description for ' || i);
  END LOOP;
  COMMIT;
END;
/

PL/SQL procedure successfully completed.

SELECT * FROM at_test;

        ID DESCRIPTION
---------- --------------------------------------------------
         1 Description for 1
         2 Description for 2
         3 Description for 3
         4 Description for 4
         5 Description for 5
         6 Description for 6
         7 Description for 7
         8 Description for 8
         9 Description for 9
        10 Description for 10

10 rows selected.

SQL>

As expected, we now have 10 rows in the table. If we now issue a rollback statement we get the following result.

ROLLBACK;
SELECT * FROM at_test;

        ID DESCRIPTION
---------- --------------------------------------------------
         3 Description for 3
         4 Description for 4
         5 Description for 5
         6 Description for 6
         7 Description for 7
         8 Description for 8
         9 Description for 9
        10 Description for 10

8 rows selected.

SQL>

The 2 rows inserted by our current session (transaction) have been rolled back, while the rows inserted by the autonomous transactions remain. The presence of the PRAGMA AUTONOMOUS_TRANSACTION compiler directive made the anonymous block run in its own transaction, so the internal commit statement did not affect the calling session. As a result rollback was still able to affect the DML issued by the current statement.

For more details visit https://www.youtube.com/watch?v=AcMHquDkl6M

Wednesday, February 27, 2013

How to Develop Oracle Form 10g

Forms Definition
Forms used for presenting and manipulating data can be developed. It is GUI used for developing client server database application.
.FMB Form Module Binary
.FMT Form Module Text
.FMX Form Module Executable

COMPONENTS OF FORMS
1.Form Builder
It is used to create a form. The design and layout of data entry screens the creations of event driven PL/SQL code used for data validation and navigate can be done via form builder.
2.Form Compiler
It is required to compile the file created in form builder and create a binary file, which can be executable form runtime.
3.Form Runtime
It is used to run the complied code created by forms compiler.
COMPONENTS OF FORM BUILDER
1. Object Navigator
It is hierarchical browsing and editing interface that enables you locate and manipulate application objects quickly and easily.
2.Property Palette
It is used set and modify the properties for all objects in form modules.
3.Layout Editor
It is graphical design facility for creating and arranging interface items and graphical objects in your application.
4.PL / SQL Editor
It is the integrated functionality of oracle procedure builder that exists with in form builder. It provides:
Development of Trigger, Procedures, Functions and Packages
Development of libraries to hold PL/SQL program unit.
FORM MODULE TYPES
1.Form Module
It is a collection of objectives such as block, canvas, items and event based PL/SQL code blocks called trigger .
2.Menu Module
It is a collection of menu items. It can be main menu or sub menu.
3.PL / SQL Libraries
The library module is a collection of PL/SQL function and package stored ion a single library file. This library file is the attached to form / menu modules. All other objects in the form or menu can now access share the collection of PL/SQL functions and procedures.
4.Object Libraries
It is a collection of form objects that you can use in other modules. You can create it to store, maintain and distribute standard objects that can be reuse across the entire development organization.
5. Object Group (Form Builder)
An object group is a container for a group of objects. You define an object group when you want to package related objects so you can copy or subclass them in another module.
OBJECTS OF FORMS
1.Blocks
Block is logical owner of items. It provides a mechanism for grouping related items into a functional unit for storing, displaying and manipulating records.
2.Items
These are interface objects that present data values to the user or enable the user to interact with the form.
3. Canvas
A canvas is the background object upon which interface items appear.
4. Frames
Frames are used to arrange items with in a block.
5. Windows
Windows contains for all visual objects that make up a form builder application.
6. PL/SQL Code Block
It is used for event driven code. That code automatically executes when a specific event occurs.
SET_FORM_PROPERTY
Sets a property of the given form.
Syntax:
SET_FORM_PROPERTY( formmodule_id, property, value);
SET_FORM_PROPERTY( formmodule_name, property, value);
BLOCKS
Block is logical owner of items. It provides a mechanism for grouping related items into a functional unit for storing, displaying and manipulating records.
Types of Blocks
1. Data Blocks
Data blocks are associated with data (table columns) within a database. By default, the association between a data block and the database allows operators to automatically query, update, insert, and delete rows within a database. Data blocks can be based on database tables, views, procedures, or transactional triggers.
2. Control Blocks
A control block is not associated with the database, and the items in a control block do not relate to table columns within a database. All blocks are either single-record or multi-record blocks:
A single-record block displays one record at a time.
A multi-record block displays more than one record at a time.
In addition, a data block can also be a master or detail block:
Master block displays a master record associated with detail records displayed in a detail block.
A detail block displays detail records associated with a master record displayed in master block.
MASTER-DETAIL RELATIONSHIP
A master-detail relationship is an association between two data blocks that reflects a primary foreign key relationship between the database tables on which the two data blocks are based.
The master data block is based on the table with the primary key, and the detail data block is based on the table with the foreign key. A master-detail relationship equates to the one-to-many relationship in the entity relationship diagram. A Detail Block Can Be a Master. You can create block relationships in which the detail of one master-detail link is the master for another link.
What Is a Relation?
relation is a Form Builder object that handles the relationship between two associated blocks.
You can create a relation either:
• Implicitly with a master-detail form module
• Explicitly in the Object Navigator
Implicit Relations
When you create a master-detail form module, a relation is automatically created. This relation
is named masterblock_detailblock, for example, S_ORD_S_ITEM.
Explicit Relations
If a relation is not established when default blocks are created, you can create your own by setting the properties in the New Relation dialog box. Like implicitly created relations, PL/SQL program units and triggers are created automatically when you explicitly create a relation.
Master Deletes
You can prevent, propagate, or isolate deletion of a record in a master block when corresponding records exist in the detail block by setting the Master Deletes property. For example, you can delete all corresponding line items when an order is deleted.
Property Use
Non-Isolated
Prevents the deletion of the master record when the detail records exist
Cascading
Deletes the detail records when a master record is deleted
Isolated
Deletes only the master record
What Happens When You Modify a Relation?
· Changing the Master Deletes property from the default of Non-Isolated to Cascading replaces the On-Check-Delete-Master trigger with the Pre- Delete trigger.
· Changing the Master Deletes property from the default of Non-Isolated to Isolated results in the removal of the On-Check-Delete-Master trigger
MASTER DELETES PROPERTY RESULTING TRIGGERS
Non-Isolated (the default) On-Check-Delete-Master On-Clear-Details
On-Populate-Details
Cascading On-Clear-Details
On-Populate-Details
Pre-Delete
Isolated On-Clear-Details
On-Populate-Details
Coordination
You can control how the detail records are displayed when a master block is queried by setting the coordination property. For example, you can defer querying the line items for an order until the operator navigates to the item block.
Default [Immediate]
The default setting. When a coordination-causing event occurs, the detail records are fetched immediately. (Deferred False, Auto-Query False)
Deferred with Auto Query
Oracle Forms defers fetching the associated detail records until the operator navigates to the detail data block.
Deferred Without Auto Query
When coordination-causing event occurs, Oracle Forms does not automatically fetch the detail records. To fetch the detail records, the operator must navigate to the detail data block and explicitly execute a query.
Prevent Masterless Operation
Ensures that the detail data block cannot be queried or used to insert records when a master record is not currently displayed.
Join Condition
Use to:
· Create links between blocks using SQL
· Alter links between blocks using SQL Define using:
· Usual SQL equi-join condition syntax
· Block names instead of the base table names
· Item names that exist in the form module instead of base table column names
Master-detail triggers
On-Check-Delete-Master, On-Populate-Details, On-Clear-Details
CANVAS
This object represents a background entity on which you place interface items, such as check boxes, radio groups, and text items. There are four types of canvas objects: Content, Stacked, Horizontal Toolbar, and Vertical Toolbar.
1.Content Canvas
The most common canvas type is the content canvas (the default type). A content canvas is the "base" view that occupies the entire content pane of the window in which it is displayed. You must define at least one content canvas for each window you create.
2.Stacked Canvas
A stacked canvas is displayed atop—or stacked on—the content canvas assigned to the current window. Stacked canvases obscure some part of the underlying content canvas, and often are shown and hidden programmatically. You can display more than one stacked canvas in a window at the same time.
3.Tab Canvas
A tab canvas—made up of one or more tab pages —allows you to group and display a large amount of related information on a single dynamic Form Builder canvas object. Like stacked canvases, tab canvases are displayed on top of a content canvas, partly obscuring it. Tab pages (that collectively comprise the tab canvas) each display a subset of the information displayed on the entire tab canvas.
4.Toolbar Canvas
A toolbar canvas often is used to create toolbars for individual windows. You can create two types of toolbar canvases: horizontal or vertical. Horizontal toolbar canvases are displayed at the top of a window, just under its menu bar, while vertical toolbars are displayed along the far left edge of a window.
Showing and hiding a canvas programmatically
SHOW_VIEW('a_stack'); or SET_VIEW_PROPERTY('a_stack', visible, property_true);
HIDE_VIEW('a_stack'); or SET_VIEW_PROPERTY('a_stack', visible, property_false);
WINDOW
A window is a container for all visual objects that make up a Form Builder application, including canvases. A single form can include any number of windows. While every new form automatically includes a default window named WINDOW1, you can create additional windows as needed by inserting them under the Windows node in the Object Navigator.
There are two window styles:
Document
Document Windows Document windows typically display the main canvases and work areas of your application where most data entry, and data retrieval is performed.
Dialog
Dialog Windows Dialog windows are free-floating, containers typically used for modal dialogs that require immediate user interaction.
Window Modality
1.Modal Windows
Modal windows are usually used as dialogs, and have restricted functionality compared to modeless windows. On some platforms, for example, end users cannot resize, scroll, or iconify a modal window. Modal windows are often displayed with a platform-specific border unique to modal windows. On some platforms, modal windows are "always-ontop" windows that cannot be layered behind modeless windows.
2. Modeless Windows
You can display multiple modeless windows at the same time, and end users can navigate freely among them (provided your application logic allows it). On most GUI platforms, you can layer modeless windows so that they appear either in front of or behind other windows.
Hide on Exit property
For a modeless window, determines whether Form Builder hides the window automatically when the end user navigates to an item in another window.
MDI and SDI windows
1. Multiple Document Interface

MDI applications display a default parent window, called the application window. All other windows in the application are either document windows or dialog windows. Document windows always are displayed within the MDI application window frame.
2. Single Document Interface

Although MDI is the default system of window management during Forms Runtime, Form Builder also provides support for an SDI root window on Microsoft Windows.REPLACE_CONTENT_VIEW built-in Replaces the content canvas currently displayed in the indicated window with a different content canvas.
REPLACE_CONTENT_VIEW (window_name VARCHAR2, view_name VARCHAR2);
** Built-in: REPLACE_CONTENT_VIEW
** Example: Replace the 'salary' view with the 'history'
** view in the 'employee_status' window. */
BEGIN
Replace_Content_View('employee_status','history');
END;
Trigger - Windows

When-Window-Activated , When-Window-Deactivated , When-Window-Closed , When- Window-Resized
ALERT
An alert is a modal window that displays a message notifying the operator of some application condition.
Use alerts to advise operators of unusual situations or to warn operators who are about to perform an action that might have undesirable or unexpected consequences.
There are three styles of alerts: Stop, Caution, and Note. Each style denotes a different level of message severity. Message severity is represented visually by a unique icon that displays in the alert window.
 OBJECT GROUPS
An object group is a container for a group of objects. You define an object group when you want to package related objects so you can copy or subclass them in another module. Object groups provide a way to bundle objects into higher-level building blocks that can be used in other parts of an application and in subsequent development projects.
You define an object group when you want to package related objects for copying or sub classing in another module. You can use object groups to bundle numerous objects into higher-level building blocks that you can use again in another application.
Using Object Groups

·        Blocks include:
Items
Item-level triggers
Block-level triggers
Relations
·        Object groups cannot include other object groups
·        Deleting:
An object group does not affect the objects
An object affects the object group
Copying an Object

Copying an object creates a separate, unique version of that object in the target module. Any objects owned by the copied object are also copied.
Use copying to export the definition of an object to another module.
·        Changes made to a copied object in the source module do not affect the copied object in the target module.
Subclassing

Subclassing is an object-oriented term that refers to the following capabilities:
·        Inheriting the characteristics of a base class (Inheritance)
·        Overriding properties of the base class (Specialization)
OBJECT LIBRARY
This object provides an easy method of reusing objects and enforcing standards across the entire development organization.
You can use the Object Library to create, store, maintain, and distribute standard and reusable objects.
In addition, by using Object Libraries, you can rapidly create applications by dragging and dropping predefined objects to your form.
·        Is a convenient container of objects for reuse
·        Simplifies reuse in complex environments
·        Supports corporate, project, and personal standards
·        Simplifies the sharing of reusable components
Object libraries are convenient containers of objects for reuse. They simplify reuse in complex environments, and they support corporate, project, and personal standards.
An object library can contain simple objects, property classes, object groups, and program units, but they are protected against change in the library. Objects can be used as standards (classes) for other objects.
Object libraries simplify the sharing of reusable components. Reusing components enables you to:
·        Apply standards to simple objects, such as buttons and items, for a consistent look and feel
·        Reuse complex objects such as a Navigator
Benefits of the Object Library

·        Simplifies the sharing and reuse of objects
·        Provides control and enforcement of standards
·        Eliminates the need to maintain multiple referenced forms
SMARTCLASS

A SmartClass is a special member of an Object Library. Unlike other Object Library members, it can be used to subclass existing objects in a form using the SmartClass option from the right mouse button popup menu. Object Library members which are not SmartClasses can only be used to create new objects in form modules into which they are added.
 If you frequently use certain objects as standards, such as standard buttons, date items, and alerts, you can mark them as SmartClasses by selecting each object in the object library and choosing Object—>SmartClass.
You can mark many different objects that are spread across multiple object libraries as SmartClasses.
·        Is an object in an object library that is frequently used as a class
·        Can be applied easily and rapidly to existing objects
·        Can be defined in many object libraries
You can have many SmartClasses of a given object
PL/SQL Libraries
library is a collection of PL/SQL program units, including procedures, functions, and packages. A single library can contain many program units that can be shared among the Oracle Developer modules and applications that need to use them.
A library:
·        Is produced as a separate module and stored in either a file or the database
·        Provides a convenient means of storing client-side code and sharing it among applications
·        Means that a single copy of program units can be used by many form,menu, report, or graphic modules
·        Supports dynamic loading of program units
 FUNCTION locate_emp(bind_value IN NUMBER) RETURN VARCHAR2 IS
v_ename VARCHAR2(15);
BEGIN
SELECT ename INTO v_ename FROM emp WHERE empno = bind_value;
RETURN(v_ename);
END;
Reasons to share objects and code:

·        Increased productivity
·        Increased modularity
·        Decreased maintenance
·        Maintaining standards
.PLL PL/SQL Library Module Binary
.PLD PL/SQL Library Module Text
.PLX PL/SQL Library Module Executable
.MMB Menu Module Binary
.MMT Menu Module Text
.MMX Menu Module Executable
Form Builder Built-in Package
EXEC_SQL Provides built-ins for executing dynamic SQL within PL/SQL procedures
VBX
Provides built-ins for controlling and interacting with VBX controls; this package works only in a 16-bit environment and is provided for backward compatibility
WEB
Provides built-ins for the Web environment
OLE2
Provides a PL/SQL API for creating, manipulating, and accessing attributes of OLE2 automation objects
SUBPROGRAM
A subprogram can be either a procedure or a function. Built-in subprograms are therefore called in two distinct ways:
·        Built-in procedures:
Called as a complete statement in a trigger or program unit with mandatory arguments.
·        Built-in functions:
Called as part of a statement, in a trigger or program unit, at a position where the function’s return value will be used. Again, the function call must include any mandatory arguments.
TRIGGER
Triggers are blocks of PL/SQL code that are written to perform tasks when a specific event occurs within an application. In effect, a Form Builder trigger is an event-handler written in PL/SQL to augment (or occasionally replace) the default processing behavior. Every trigger has a name, and contains one or more PL/SQL statements. A trigger encapsulates PL/SQL code so that it can be associated with an event and executed and maintained as a distinct object.
Trigger Scope

1.Form Level
The trigger belongs to the form and can fire due to events across the entire form.
2.Block Level
The trigger belongs to a block and can only fire when this block is the current block.
3.Item Level
The trigger belongs to an individual item and can only fore when this item is the current item.
Trigger Properties
Execution Style
Execution Hierarchy property
Specifies how the current trigger code should execute if there is a trigger with the same name defined at a higher level in the object hierarchy.
The following settings are valid for this property:
Override
Specifies that the current trigger fire instead of any trigger by the same name at any higher scope. This is known as "override parent" behavior.
Before
Specifies that the current trigger fire before firing the same trigger at the next-higher scope. This is known as "fire before parent" behavior.
After
Specifies that the current trigger fire after firing the same trigger at the next-higher scope. This is known as "fire after parent" behavior.
What are triggers used for?
·         Validate data entry
·         Protect the database from operator errors
·         Limit operator access to specified forms
·         Display related field data by performing table lookups
·        Compare values between fields in the form
·        Calculate field values and display the results of those calculations
·        Perform complex transactions, such as verifying totals
·        Display customized error and information messages to the operator
·        Alter default navigation
·        Display alert boxes
·        Create, initialize, and increment timers
 Groups of triggers

GROUP

FUNCTION

When-triggers

Execute in addition to default processing
On-triggers

Replace default processing
Pre- and Post-triggers

Add processing before or after an event

Key-trigger
Change default processing assigned to a specific key
 Open Oracle Form 10g:
Navigation : Start Menu -> All Programs -> Oracle Developer Suite – 10g -> Form Developer -> Form Builder