[comp.databases] Still need help referencing globals in ORACLE SQL*FORMS triggers

beverly@ai.cs.wisc.edu (Beverly Seavey (-Kung)) (09/12/90)

  I am still having trouble attempting to reference a global variable
during the course of an ORACLE SQL*FORMS trigger, (v. 5)
The value a global  "curr_nucleus" is created by being assigned a value
in the form NEW2_JOIN. NEW2_JOIN calls the form "A". The pre-form trigger
of A contains the SQL statement:

	 SELECT atom_numb, atom_name
	 INTO   poss_atoms.atom_numb, poss_atom.atom_name
	 FROM   atom_lookup
	 WHERE  atom_lookup.nucleus = :global.curr_nucleus

if the last line is either

	 WHERE atom_lookup.nucleus = :global.curr_nucleus
or
	 WHERE atom_lookup.nucleus = :GLOBAL.curr_nucleus,

then I get an error during the generation of form A:

	 GLOBAL : no such block.

if the last line is either

	 WHERE atom_lookup.nucleus = global.curr_nucleus
or
	 WHERE atom_lookup.nucleus = GLOBAL.curr_nucleus

then when the form A is called I get the ORACLE error:

	 "curr_nucleus  invalid column name"

Renaming the global doesn't help.
What am I doing wrong? Are ORACLE globals not so global?

beverly@ai.cs.wisc.edu (Beverly Seavey (-Kung)) (09/13/90)

 Sorry  -- that's SQL*FORMS 2.0,  ORACLE 5

mouser@portia.Stanford.EDU (Michael Wang) (09/14/90)

In article <11240@spool.cs.wisc.edu>,
beverly@ai.cs.wisc.edu (Beverly Seavey (-Kung)) writes:
>  I am still having trouble attempting to reference a global variable
>during the course of an ORACLE SQL*FORMS trigger, (v. 5)
[...stuff deleted...]


You can't reference global variables in SELECT statements (at least
under versions 2.0 and 2.3). You need to first copy the value in
the global variable to a temporary, non-database field using the COPY
command and then reference the temporary field in the SELECT statement.

For example:

PRE-FORM Trigger

Step# 1

     #COPY global.curr_nucleus :temp_field


Step# 2

     SELECT atom_numb, atom_name
     INTO   poss_atoms.atom_numb, poss_atom.atom_name
     FROM   atom_lookup
     WHERE  atom_lookup.nucleus = :temp_field



Michael Wang
mouser@portia.stanford.edu