When you call a function, you need to consider the data type of the function's return value. Functions can be combined with constants, variables, and logical operators to form an expression. Because they return a single value, functions can be used in the same way as local variables or constants of the same type.
DECLARE
item_required VARCHAR2 (5);
BEGIN
item_required := Get_Item_Property('customer.custid',REQUIRED);
END;
The Built-in function GET_ITEM_PROPERTY is called to get the current setting of the Required property for the custid item in the customer block. Because the return type of the GET_ITEM_PROPERTY function is CHAR, the variable to which the return value is assigned must either be of type CHAR or VARCHAR2.
:control.item_A := Message_Text;
The MESSAGE_TEXT function returns a CHAR value that is assigned to item_A in the control block. item_A must be the same type as the return value of the MESSAGE_TEXT function.
Go_Item(Get_Block_Property('customer',LAST_ITEM));
The GET_BLOCK_PROPERTY function is used to get the name of the last item in the customer block. The GET_BLOCK_PROPERTY function is nested as a parameter to the GO_ITEM procedure, and its return value is the target item for the GO_ITEM operation.
IF Show_LOV('customer_List') THEN
Message('Good Selection.');
ELSE
Message('No Customer was Selected.');
END IF;
A function that has a BOOLEAN return type evaluates to either TRUE or FALSE, and so can be used as an expression in a conditional statement.
The function SHOW_LOV first displays the List of values named customer_List, then waits for operator input; if the operator selects a record from the LOV, the function returns TRUE; if the operator dismisses the LOV by choosing Cancel, it returns FALSE.
Note: Functions cannot be used in DML statements. You can achieve the same result by assigning the return value of the function to a local variable, and then referencing the variable in the DML statement.