Press "Enter" to skip to content

Copy Command in Oracle D2k

Copy Command in Oracle D2k

Usage Notes
·  When using COPY with date values, the format defined in the BUILTIN_DATE_FORMAT
property will be used if the DATE_FORMAT_COMPATIBILITY_MODE property is set to 5.0. If
this property is set to 4.5 COPY will expect date strings to be formatted using the default American
format.
·  To use a text item as the source reference, you can use the following code:
COPY(NAME_IN(source), destination);
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 Form Builder
** 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;