Oracle Forms does not allow the use of bind variables when code is in a library or menu.
You can indirectly reference the NAME_IN and COPY elements of the Subroutine. The NAME_IN function returns the contents of the specified variable or element. Use the NAME_IN function to get the value of an element without directly accessing the element. The following statements are equivalent:
IF: emp.ename = 'smith' - direct link
IF NAME_IN ('emp.ename') = 'smith' - indirect link
The return value is always a character string. To use NAME_IN for DATE or NUMBER, convert the string to the desired data type using the appropriate conversion function:
date_var: = TO_DATE (Name_In ('order.date_item')); num_var: = TO_NUMBER (Name_In ('order.number_item'));
Notes on NAME_IN:
. Function NAME_IN cannot return the contents of a global or local variable.
ยท In PL / SQL triggers that will be executed in I / O mode, you should use NAME_IN instead of the usual variable binding record to access the value in the data block. (This is because the end user can inject relational operators into the element, creating a value that is not in the form that PL / SQL can handle.)
COPY Procedure The COPY procedure assigns the specified value to the specified variable or element. Unlike the standard PL / SQL assignment, however, using the COPY procedure, you can indirectly reference an element whose value is set:
: emp.ename: = 'smith'; - direct link Copy ('blacksmith', 'emp.ename'); - indirect link
COPY can be used with the NAME_IN function to assign a value to an element whose name is stored in a reference variable or element:
/ * put the value "blacksmith" in the element whose name is stored in ref_item * / Copy ('blacksmith', Name_In ('control.ref_item'));
Why use indirect links
Linking to objects indirectly allows you to write a more general, reusable code. Using variables instead of the names of the actual elements, you can write a routine that can work on any element whose name is assigned to the specified variable. Also, the use of an indirect reference is required if you refer to the value of form bind variable (item, parameter, global variable) in PL / SQL, which you write in the library or in the menu module. Since libraries, menus, and forms are separate application modules, you cannot directly refer to the value of a form element in a command or library in the Procedure menu.