Other forms of global variables

Dicas do Oracle Forms Builder - Blocos, Itens, LOV, Canvas, Triggers, comandos, PLL, d2kwutil, FMB, Alert, menus, etc
Post Reply
User avatar
tfg
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 83
Joined: Mon, 03 May 2004 3:38 pm
Location: Lisboa

How can I create a variable that can be manipulated in all procedures of a form without using global?
User avatar
dr_gori
Moderador
Moderador
Posts: 5027
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Global \r\n

Really, global are not legal, because they occupy 256 bytes and are always char. (You can even store numbers, but they are converted at the time of use).

Select all

:global.sua_var:='sua_string';
Parameters \r\n


has the parameters, which are better than global As they support a larger number of bytes. (not only 256).

Select all

:parameter.seu_par:='sua_string';
Forms Packages - Best Practice! [/ Size]

You create a package Specs and declares a variable there. So you can use it or change it anywhere in the program. (Of course, you can use all types of variables, including Boolean).

Select all

PACKAGE PKG_TESTE IS 
  sua_var     varchar2(10):='TESTE'; 
  valida_trig boolean; 
END;
I think the global should be used only when you want to transfer information between several distinct forms. If it is only between procedures of the same form, it is best to use variable packages.
eduardo
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 56
Joined: Tue, 10 Jul 2007 3:24 pm
Location: sp
Sempre há algo a aprender....

One thing happened to me today: By assigning a numbering value to my global variable in Runtime gave error 06502: inconsistent datatypes; I had to put a toar to the assignment.

: Global.Conta_Transacoes = to_char (3);

To assign letter to number is from which version of Forms?
mprocha
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 19
Joined: Fri, 11 Jul 2008 11:14 am
Location: Campinas - SP
Marcos Pinheiro da Rocha
Desenvolvedor Java/Forms/PL-SQL

The packages can also be used in a global way between the invoked forms, but they must be defined in PLL and it should be stabbed in all forms that will use these global variables.
At the time of calling the forms you must use Call_Form by passing the Share_Library_Data parameter, so the defined and assigned variables in these packages can be manipulated by all forms that share this PLL.
I particularly use much for popular and read arrays between a form and another.
ABS,
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest