Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION salarystatus(employee_id integer) RETURNS VARCHAR(25)
- DETERMINISTIC
- BEGIN
- DECLARE isalary DECIMAL(8,2);
- DECLARE istatus varchar(25);
- SELECT salary INTO isalary
- FROM employees
- WHERE employee_id = salarystatus.employee_id;
- IF (isalary < 50000) then
- SET istatus = 'low income';
- ELSEIF (50000 <= isalary < 80000) then
- SET istatus = 'medium income';
- ELSE
- SET istatus = 'high income';
- ENDIF
- RETURN istatus
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement