Oracle Forms全局变量使用

参考帮助手册

A global variable is a Oracle Forms variable whose value is accessible to triggers and subprograms in any module that is active during the current session. In previous versions of Oracle Forms, a global variable stores a character string of up to 255 bytes in length, for all usages. In Oracle Forms 10g, global variables are now limited to 4000 bytes when they are set or referenced using PL/SQL bind variable notation; for other usages, no limit is imposed.
Global variables are not formally declared the way PL/SQL local variables are. Rather, you initialize a global variable the first time you assign a value to it:
:GLOBAL.my_var := TO_CHAR(:order.total * .85);
To reference a global variable, prefix the variable name with the word GLOBAL and a colon. The following example shows a global variable passed as an actual parameter to a procedure call: calculate_discount(TO_NUMBER(:GLOBAL.my_var));
Referencing a global variable that has not been initialized through assignment causes a runtime error. To destroy a global variable and release its memory, use the ERASE Built-in procedure:
Erase(‘GLOBAL.my_var’);

Oracle Forms全局变量定义,只要在第一次赋值时就定义好了,比如:global.var1 := ‘xxxxx’;
全局变量是整个session内都可以访问,而不仅是一个form内。注意全局变量会长期占用资源,不用的话要及时释放,Erase(‘GLOBAL.my_var’)

おすすめ

転載: blog.csdn.net/qingshimoon4/article/details/109801493