Wednesday, June 17, 2015


 Oracle Form Global Variable Recognition


In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,


Global Variable
·        Global variables has a global scope; it is visible (accessible) throughout your application program.
·        Global variables are used extensively to pass information between forms.
·        Global variables can be initialized or declared in two different ways:

  •      DEFAULT_VALUE built-in.                                                  DEFAULT_VALUE ('Al-Emran', 'global.company_name');

  •        PL/SQL assignment statement                                                  Global.company_name := 'Al-Emran'; 
 

Global Variable Types
Oracle Forms Developer and PL/SQL support different types
  • Oracle Forms Global: a variable in the "global" pseudo-block of a form
  • PL/SQL Package Global: a global defined in the specification of a package
  • Oracle Forms Parameter: a variable created within the Oracle Forms Designer as a Parameter

Pls. see the Oracle Forms Reference Manual for a complete description of these variable types.
 The following table lists the characteristics of each type of variable, and enables you to select the type most appropriate for your code.
Behavior
Oracle Forms Global
PL/SQL Package Global
Oracle Forms Parameter
Can be created at Design time

Y
Y
Can be created at runtime
Y


Accessible across all forms
Y


Accessible from attached libraries
Y
(1)
Y
Support specific data types
(2)
Y
Y
Have declarative defaults


Y
Can be referenced indirectly
Y

Y
Can be specified on command line


Y
Must be erased to recover memory
Y


Can be used in any Oracle Forms code
Y

Y



Global Variable Limitations  

·        Global variables do not generate any compilation errors during development stage but only run-time errors.

·        Global variables are always characters. If you are not familiar with this fact, your expected output will not work; no effect.

       Now Current situation

§    On development stage, at design-time, you will not face any compilation error.
§   On test stage, at run-time you will not face any run-time error.
        You will have  just silent failure with no explanation and sucked helpless. It's                 better to know this case before wasting effort and time.

·     A significant drawback of Global variables; it consumes high memory resources:
§  Memory is an important resource for your application so it’s wise to consider choosing other alternatives for Global variables.
§   Form Parameters are recommended alternative instead of using Global variables.

·     Global variables usage is recommended Not to use them if un-necessary.

·     Global variables persist in memory until you remove it externally with the ERASE () built-in procedure.

·     Global variables must be declared, if Not initialize before execution, it will generate run-time error.

FRM-40815 GLOBAL. does not exist.

              Warning Avoid above error by assigning the appropriate value to                                             the global variable before opening the new form.

·        In fact, they are usually considered bad practice precisely because of their non-locality.


·     Each Global variable Must has the same name to each form session.



          Warning: Oracle recommends explicit conversions, rather than rely on                                         implicit or automatic conversions for these reasons:

·        You will need   using a NUMBER using the TO_NUMBER() function or using TO_DATE() functions. 

   

  For more related detailed Global variables usage pls read 



Hope this helps…


My success only comes from Allah, pls. note your comments and suggestions are great help for me in progress thanks in advance.



No comments :