Sunday, 16th October 2011
Follow WikiJava on twitter now. @Wikijava

Packagedemo.sql

From WikiJava

Jump to: navigation, search


PL/SQL is Oracle's procedural extension to SQL, the standard database access language.

Contents

the article

This simple package contains a function that is used to select fields from a view and perform calculations on the fields and return a result.

Monthly_Amount

/* package declarations */
 
 
 
CREATE OR REPLACE PACKAGE BODY dbms_paye AS
 
 
 
FUNCTION MONTHLY_AMT (cal_amt IN emp_rem.REM_AMT%TYPE, cal_bal IN emp_rem.REM_BAL%TYPE, cal_inst IN emp_rem.REM_INST%TYPE, cal_int IN emp_rem.REM_INT%TYPE)RETURN NUMBER AS
 
  BEGIN
 
    /* This function is used to display the payroll amount in a single column */
 
    IF cal_int IS NULL AND cal_inst IS NULL THEN
 
      temp_amt:=cal_amt;
 
    ELSIF cal_int IS NULL AND cal_inst IS NOT NULL THEN
 
      temp_amt:=cal_amt/cal_inst;
 
    ELSE
 
        IF cal_bal IS NULL THEN
 
          temp_amt:=cal_amt*cal_int;
 
        ELSE
 
          temp_amt:=cal_bal*cal_int;
 
        END IF;
 
    END IF;
 
    RETURN (temp_amt);
 
  END MONTHLY_AMT;
 
END DBMS_PAYE;
 
/
 
 
 
COMMIT;


Comments from the users

To be notified via mail on the updates of this discussion you can login and click on watch at the top of the page


Comments on wikijava are disabled now, cause excessive spam.