Previous
Previous
 
Next
Next

Create a Function

First, create a function to calculate employees' salaries.

To create a function:

  1. Click the Application link on the Developer toolbar (at the bottom of the page).

    The Application home page appears.

  2. Click the Home breadcrumb link in the title bar.

    Description of home_brdcrmb.gif follows
    Description of the illustration home_brdcrmb.gif

  3. Click SQL Workshop and then SQL Commands.

    SQL Commands provides a window where you can run PL/SQL against the database.

  4. In the SQL editor, enter the following script:

    CREATE OR REPLACE FUNCTION calc_remuneration(
        salary IN number, commission_pct IN number)
    RETURN NUMBER IS
    BEGIN
        RETURN ((salary*12) + (salary * 12 * nvl(commission_pct,0)));
    END;
    
    
  5. Click Run.

    The Results section displays this message:

    Function created.