Press "Enter" to skip to content

DEFAULT_VALUE in Oracle D2k

DEFAULT_VALUE in Oracle D2k

Description
Copies an indicated value to an indicated variable if the variable’s current value is NULL. If the
variable’s current value is not NULL, DEFAULT_VALUE does nothing. Therefore, for text items this
built-in works identically to using the COPY built-in on a NULL item. If the variable is an undefined
global variable, Form Builder creates the variable.
Syntax

PROCEDURE DEFAULT_VALUE
(value_string VARCHAR2,
variable_name VARCHAR2);
Built-in Type unrestricted procedure
Enter Query Mode yes
Parameters
value_string A valid VARCHAR2 string, variable, or text item containing a valid string.
variable_name A valid variable, global variable, or text item name. The data type of the
variable_name is VARCHAR2. Any object passed as an argument to this
built-in must be enclosed in single quotes.
DEFAULT_VALUE restrictions
The DEFAULT_VALUE built-in is not related to the Initial Value item property.
DEFAULT_VALUE examples
/*
** Built-in: DEFAULT_VALUE
** Example: Make sure a Global variable is defined by
** assigning some value to it with Default_Value
*/
BEGIN
/*
** Default the value of GLOBAL.Command_Indicator if it is
** NULL or does not exist.
*/
Default_Value(’***’,’global.command_indicator’);
/*
** If the global variable equals the string we defaulted
** it to above, then it must have not existed before
*/
IF :Global.Command_Indicator = ’***’ THEN
Message(’You must call this screen from the Main Menu’);
RAISE Form_trigger_Failure;
END IF;
END;