Re: Declaring and using Global Variables
Date: Mon, 04 Oct 1999 16:44:40 GMT
Message-ID: <7talhj$8li$1_at_nnrp1.deja.com>
Farjaad,
- Say you wish to set a flag in a module, then later when another button is pressed use that information...
- Or suppose that it is easier just to set some globals temporarily to use in another module, rather than build a whole parameter block to pass parameters...
In the first trigger...
:global.myflag := 'my text value';
All globals are text, with maximum 255 (?, 256?) characters,
at least in Forms 5.
Later, in another trigger...
If :global.myflag = 'my text' Then
Elsif :global.myflag = 'another choice' then
else etc.... end if;
Two valuable functions:
DEFAULT_VALUE('x','global.myflag');
ERASE('global.myflag');
Default_value says, "do a test for :global.myflag, and
if it already exists, fine, just let it be and move on,
but if it does not exist, then create it and give it
a value of 'x'.
Erase destroys the variable.
Example:
DEFAULT_VALUE(NULL, 'global.myflag'); IF :global.myflag IS NULL then :global.myflag := 'FirstTime'; END IF;
Two other functions:
NAME_IN, and COPY.
Name_In is for indirect referencing, valuble when you cannot
you bind syntax (:global.xxx is not allowed in a procedure or
function)...
Thus: If NAME_IN('global.myflag') IS NULL .....
note the variable typed as is a text string in single quotes.
COPY is also for use with indirect referencing...
COPY( value, destination)
COPY('my text', 'global.myflag');
This is how you would do an assignment in a procedure (bind syntax not allowed). COPY( NAME_IN('global.myflag'), 'global.myflag2'); copy the contents of -- global.myflag into global.myflag2.
Robert Proffitt
Beckman Coulter
Brea, California
In article <x8ZJ3.1415$ra5.162_at_tundra.ops.attcanada.net>,
"OraFan" <farjaad_at_yahoo.com> wrote:
> Hi Guys
>
> I am very new in programming stuff, and have been reading oracle
> d2k books for some time, most of these books refer to the term
'Writing
> Flexible Code' most of which refer to Using Global Variables, but I
could
> not find one good example of declaring and using a global variable in
the
> application examples given in the books
>
> Can you please be kind enough to give me a very practical example of
> declaring and using a global variable in any of the triggers or
procedures
> your example should show how to define or declare a global variable
and how
> to store value in it and how to make use of that value (global
variable).
>
> Thanks so much for your time to read this all and thanks even so much
more
> for replying me with what I am looking for
>
> Thanks
> Farj
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Oct 04 1999 - 18:44:40 CEST