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

About formulas

Formulas are PL/SQL functions that populate formula or placeholder columns. You can access the PL/SQL for formulas from the Object Navigator, the PL/SQL Editor, or the Property Inspector (that is, the PL/SQL Formula property).

A column with Datatype property set to Number can only have a formula that returns a value of datatype NUMBER. A column with Datatype property set to Date can only have a formula that returns a value of datatype DATE. A column with Datatype property set to Character can only have a formula that returns a value of datatype CHARACTER, VARCHAR, or VARCHAR2.

Restrictions

Examples

Example 1: Adding values

The following example populates the column with the value of the salary plus the commission.


function salcomm return NUMBER is
begin
  return(:sal + :comm);
end;

Example 2:   Using conditions

The following code adds the commission to the salary if the value for the commission is not null.


function calcomm return NUMBER is
temp number;
begin
  if :comm IS NOT NULL then
    temp := :sal + :comm;
  else
    temp := :sal;
  end if;
  return (temp);
end;

See also

About formula columns

Creating or editing a formula column

Creating a placeholder column