A script-enabled browser is required for this page to function properly.

COPY Built-in

Description

Copies a value from one item or variable into another item or global variable. Use specifically to write a value into an item that is referenced through the NAME_IN Built-in. COPY exists for two reasons:

Syntax

PROCEDURE COPY
(source VARCHAR2,
destination
VARCHAR2);

Built-in Type unrestricted procedure

Enter Query Mode yes

Parameters

source The source is a literal value.

destination The destination can be either a text item or another global variable.

Usage Notes

COPY Restrictions

No validation is performed on a value copied to a text item. However, for all other types of items, standard validation checks are performed on the copied value.

COPY Examples

Example 1

/*

** Built-in: COPY
** Example: Force a wildcard search on the EmpNo item during
** query.
** Trigger: Pre-Query
*/
DECLARE
cur_val VARCHAR2(40);
BEGIN
/*
** Get the value of EMP.EMPNO as a string
*/
cur_val := Name_In('Emp.Empno');
/*
** Add a percent to the end of the string.
*/
cur_val := cur_val || '%';
/*
** Copy the new value back into the item so Oracle Forms
** will use it as a query criterion.
*/
Copy( cur_val, 'Emp.Empno' );
END;

Example 2

/*

** Built-in: COPY
** Example: Set the value of a global variable whose name is
** dynamically constructed.
*/
DECLARE
global_var_name VARCHAR2(80);
BEGIN
IF :Selection.Choice = 5 THEN
global_var_name := 'Storage_1';
ELSE
global_var_name := 'Storage_2';
END IF;
/*
** Use the name in the 'global_var_name' variable as the
** name of the global variable in which to copy the
** current 'Yes' value.
*/
COPY( 'Yes', 'GLOBAL.'||global_var_name );
END;