SHARE
TWEET

Untitled

a guest Jun 26th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE FUNCTION salarystatus(employee_id integer) RETURNS VARCHAR(25)
  2. DETERMINISTIC
  3. BEGIN
  4.  
  5.    DECLARE isalary DECIMAL(8,2);
  6.    DECLARE istatus varchar(25);
  7.  
  8.         SELECT salary INTO isalary
  9.         FROM employees
  10.         WHERE employee_id = salarystatus.employee_id;
  11.  
  12.     IF (isalary < 50000) then
  13.         SET istatus = 'low income';
  14.     ELSEIF (50000 <= isalary < 80000) then
  15.         SET istatus = 'medium income';
  16.     ELSE
  17.         SET istatus = 'high income';
  18.     ENDIF
  19.  
  20.     RETURN istatus
  21.  
  22. END
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top