1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| DECLARE vn_salary NUMBER := 0; vn_department_id NUMBER := 0; BEGIN vn_department_id := ROUND(DBMS_RANDOM.VALUE(10,120),-1); SELECT salary INTO vn_salary FROM employees WHERE department_id = vn_department_id AND ROWNUM=1; DBMS_OUTPUT.PUT_LINE(vn_salary);
IF vn_salary BETWEEN 1 AND 3000 THEN DBMS_OUTPUT.PUT_LINE('low value'); ELSIF vn_salary BETWEEN 3001 AND 6000 THEN DBMS_OUTPUT.PUT_LINE('mid value'); ELSIF vn_salary BETWEEN 6001 AND 10000 THEN DBMS_OUTPUT.PUT_LINE('high value'); ELSE DBMS_OUTPUT.PUT_LINE('highest'); END IF; END;
|