Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Declaring and using Global Variables

Re: Declaring and using Global Variables

From: QuestionExchange <USENET_at_questionexchange.com>
Date: 26 Oct 1999 01:49:00 GMT
Message-ID: <2079qx@questionexchange.com>


Farj
This is a really simple one. Calling form B from form A and I wish to pass a value.
In form A I create the global -

   :global.passval := :blocka.valueb;
This creates a global called passval. It populates it with the value from field valueb
in blocka. The I call form B. In form B I have a WHEN_NEW_FORM_INSTANCE or a key startup which is going to check for this global to exist.

   default_value('NULL','global.passval'); Word of caution - I don't have my book handy and I tend to get this backwards. If I've specified the parameters the right way a NULL will be plassed in global.passval IF the global did not already exist. If the global
already exists it's value will not be changed. The reason for doing this is that next we're going to check the value of the global.

   IF :global.passval = NULL then
   /* take action based on there being no value passed */      ...
   ELSE
   /* take action based on the global existing */      ...
   END IF;
If the global doesn't exist form B may have been called from somewhere else rather than form A. the IF statement will fail if done wihtout the default_value.
Later I can use the passed value to establish a query variable or whatever.
does this help?
Becca
> 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
>
>
>
>

--
  This answer is courtesy of QuestionExchange.com   http://www.questionexchange.com/showUsenetGuest.jhtml?ans_id=6345&cus_id=USENET&qtn_id=4010 Received on Mon Oct 25 1999 - 20:49:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US