KEMBAR78
Oracle Forms: create debug triggers | PPT
Creating & Debugging Triggers
Objectives
• How to Create Triggers?
• Writing trigger code
• Describe Built-in sub-programs used in Forms
• When-Button-Pressed Trigger
• When-Window-Closed Trigger
• Debugging Triggers
How to Create a Trigger?
Trigger PL/SQL Block
• DECLARE
------- Declarative statements (OPTIONAL)
• BEGIN
------- Executable statements (MANDATORY)
• EXCEPTION
--------- Exception Handling. (OPTIONAL)
• END;
Variables in Form Builder
• PL/SQL variables must be declared in triggers or must be defined in a
package
• Form Builder variables not required to be declared
– Requires a Colon Prefix
Form Builder Variables
• Items
For presentation and user interaction :block_name.item_name
• Global variables
Session-wide character variable :GLOBAL.var_name
• System variables
Form status and control :SYSTEM.var_name
• Parameters
Passing values in and out of module :PARAMENTER.parameter
Form Builder Built-in Subprograms
Built-ins belong to either:
• The Standard Extensions package where no prefix is required
• Another Form Builder package where a prefix is required
Built-in
Restricted
Built-ins
Unrestricted
Built-ins
Allowed only
In certain
Triggers
Allowed In Any
Trigger or
subprogram
Built-in Subprograms
• EDIT_TEXTITEM
• ENTER_QUERY
• EXECUTE_QUERY
• EXIT_FORM
• GO_BLOCK
• GO_ ITEM
• NEXT_RECORD
• PREVIOUS_RECORD
• MESSAGE
• SHOW_ALERT
• SHOW_ EDITOR
• SHOW_ LOV
• SHOW_VIEW
• HIDE_VIEW
• GET_ITEM_PROPERTY
• SET_ITEM_PROPERTY
When-Button-Pressed Trigger
• Fires when the operator clicks a button.
• Accepts restricted and unrestricted
built-ins.
• Used for existing form, Display LOVs, Editors etc.
Example
GO_BLOCK(‘EMP’);
EXECUTE_QUERY;
When-Window-Closed Trigger
• Fires when the operator closes a window by clicking button.
• Accepts restricted and unrestricted built-ins.
• Used to programmatically close a window when the operator issues a
window manager-specific close command. You can close a window by
using built-ins.
When-Window-Closed
Trigger at Form Level.
EXIT_FORM;
Debugging Triggers
• Monitor and Debug Triggers by:
– Compiling and rectifying errors in the PL/SQL Editor
– Displaying debug messages at run time
– Invoking the PL/SQL Debugger
Debugging Triggers -Tips
• Connect to Database before compiling SQL statements.
• Define triggers always at the correct level
• Terminate statements with semicolon where ever necessary.
• Watch for missing quotation marks
• Place the triggers where the event will happen.
Running a Form In Debug Mode
Forms
Debugger
Window
Run Form Debug
Debug Triggers and Breakpoint
Every
statement
Debugger
Program Unit
Statement
Statement
Statement
Debug
trigger
Breakpoint
trigger
Fire
Fire
Fire
Breakpoint
PL/SQL Debugger
Step Into
Step Over
Step Out
Go Reset
Debug Commands
Summary
• Creating Trigger
• From Built-ins
• Restricted and Unrestricted built-ins
• When-Button-Pressed trigger
• When-Window-Closed Trigger

Oracle Forms: create debug triggers

  • 1.
  • 2.
    Objectives • How toCreate Triggers? • Writing trigger code • Describe Built-in sub-programs used in Forms • When-Button-Pressed Trigger • When-Window-Closed Trigger • Debugging Triggers
  • 3.
    How to Createa Trigger?
  • 4.
    Trigger PL/SQL Block •DECLARE ------- Declarative statements (OPTIONAL) • BEGIN ------- Executable statements (MANDATORY) • EXCEPTION --------- Exception Handling. (OPTIONAL) • END;
  • 5.
    Variables in FormBuilder • PL/SQL variables must be declared in triggers or must be defined in a package • Form Builder variables not required to be declared – Requires a Colon Prefix
  • 6.
    Form Builder Variables •Items For presentation and user interaction :block_name.item_name • Global variables Session-wide character variable :GLOBAL.var_name • System variables Form status and control :SYSTEM.var_name • Parameters Passing values in and out of module :PARAMENTER.parameter
  • 7.
    Form Builder Built-inSubprograms Built-ins belong to either: • The Standard Extensions package where no prefix is required • Another Form Builder package where a prefix is required Built-in Restricted Built-ins Unrestricted Built-ins Allowed only In certain Triggers Allowed In Any Trigger or subprogram
  • 8.
    Built-in Subprograms • EDIT_TEXTITEM •ENTER_QUERY • EXECUTE_QUERY • EXIT_FORM • GO_BLOCK • GO_ ITEM • NEXT_RECORD • PREVIOUS_RECORD • MESSAGE • SHOW_ALERT • SHOW_ EDITOR • SHOW_ LOV • SHOW_VIEW • HIDE_VIEW • GET_ITEM_PROPERTY • SET_ITEM_PROPERTY
  • 9.
    When-Button-Pressed Trigger • Fireswhen the operator clicks a button. • Accepts restricted and unrestricted built-ins. • Used for existing form, Display LOVs, Editors etc. Example GO_BLOCK(‘EMP’); EXECUTE_QUERY;
  • 10.
    When-Window-Closed Trigger • Fireswhen the operator closes a window by clicking button. • Accepts restricted and unrestricted built-ins. • Used to programmatically close a window when the operator issues a window manager-specific close command. You can close a window by using built-ins. When-Window-Closed Trigger at Form Level. EXIT_FORM;
  • 11.
    Debugging Triggers • Monitorand Debug Triggers by: – Compiling and rectifying errors in the PL/SQL Editor – Displaying debug messages at run time – Invoking the PL/SQL Debugger
  • 12.
    Debugging Triggers -Tips •Connect to Database before compiling SQL statements. • Define triggers always at the correct level • Terminate statements with semicolon where ever necessary. • Watch for missing quotation marks • Place the triggers where the event will happen.
  • 13.
    Running a FormIn Debug Mode Forms Debugger Window Run Form Debug
  • 14.
    Debug Triggers andBreakpoint Every statement Debugger Program Unit Statement Statement Statement Debug trigger Breakpoint trigger Fire Fire Fire Breakpoint
  • 15.
    PL/SQL Debugger Step Into StepOver Step Out Go Reset Debug Commands
  • 16.
    Summary • Creating Trigger •From Built-ins • Restricted and Unrestricted built-ins • When-Button-Pressed trigger • When-Window-Closed Trigger

Editor's Notes

  • #6 Note: You can use DEFAULT_VALUE built-in to declare global variables. Example: DEFAULT_VALUE( ‘HYDERABAD’,’GLOBAL.city’ ); You can use ERASE Built-in to remove global variables. Globals always allocate 255 bytes of storage. To ensure that performance is not impacted more than necessary, always erase any global variable When it is no longer required.
  • #14 Note: Break points must be attached to an executable statement in the body of the Code. Comments lines or NULL commands are not valid for this purpose.