.. . .. . ..
v_titil VARCHAR2(10); BEGIN v_sex:=''; IF v_sex ='男' THEN v_titil:='先生'; ELSIF v_sex = '女' THEN v_titil:='女士'; ELSE v_titil:='朋友'; END IF; DBMS_OUTPUT.PUT_LINE(v_titil||'您好!'); END; . 专业学习资料 .
.. . .. . ..
SET SERVEROUTPUT ON DECLARE v_sal NUMBER(5); v_tax NUMBER(5,2); BEGIN SELECT sal INTO v_sal FROM emp WHERE empno=7788; IF v_sal >=3000 THEN V_tax:= v_sal*0.08;--税率8% ELSIF v_sal>=1500 THEN V_tax:= v_sal*0.06; --税率6% ELSE V_tax:= v_sal*0.04; --税率4% END IF; DBMS_OUTPUT.PUT_LINE('应缴税金:'||V_tax); END; . 专业学习资料 .
.. . .. . ..
SET SERVEROUTPUT ON DECLARE v_job VARCHAR2(10); BEGIN SELECT job INTO v_job FROM emp WHERE empno=7788; CASE v_job WHEN 'PRESIDENT' THEN DBMS_OUTPUT.PUT_LINE('雇员职务:总裁'); WHEN 'MANAGER' THEN DBMS_OUTPUT.PUT_LINE('雇员职务:经理'); . 专业学习资料 .
.. . .. . ..
WHEN 'SALESMAN' THEN DBMS_OUTPUT.PUT_LINE('雇员职务:推销员'); WHEN 'ANALYST' THEN DBMS_OUTPUT.PUT_LINE('雇员职务:系统分析员'); WHEN 'CLERK' THEN DBMS_OUTPUT.PUT_LINE('雇员职务:职员'); ELSE DBMS_OUTPUT.PUT_LINE('雇员职务:未知'); END CASE; END; SET SERVEROUTPUT ON DECLARE . 专业学习资料 .
.. . .. . ..
v_grade VARCHAR2(10); v_result VARCHAR2(10); BEGIN v_grade:='B'; v_result:=CASE v_grade WHEN 'A' THEN '优' WHEN 'B' THEN '良' WHEN 'C' THEN '中' WHEN 'D' THEN '差' ELSE '未知' END; DBMS_OUTPUT.PUT_LINE('评价等级:'||V_result); END; . 专业学习资料 .
华南农业大学数据库系统概念实验报告六
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)