瀑布模型图,
和语言没有关系, 讲究瀑布模型, 建议大家学习软件工程
编码之前首先设计程序 ,设计程序好了之后然后进行编码
/** 查询员工入职的时间总数 流程分析 : 查询返回集合->光标的定义->循环数据存入变量->退出 count80 number : = 0 ; count81 number : = 0 ; count82 number : = 0 ; count87 number : = 0 ; */ declare -- 定义变量 count80 number := 0 ; count81 number := 0 ; count82 number := 0 ; count87 number := 0 ; -- 定义指针 cursor cemp is select to_char(hiredate,'yyyy') from emp ; phiredate varchar2(4); begin open cemp ; loop -- 用指针取出年份 fetch cemp into phiredate ; exit when cemp%notfound ; if phiredate='1980' then count80 := count80+1 ; elsif phiredate ='1981' then count81 :=count81+1 ; elsif phiredate ='1982' then count82 :=count82+1 ; else count87:=count87 +1 ; end if; end loop ; close cemp; dbms_output.put_line('Total:' || (count80+count81+count82+count87)); dbms_output.put_line('1980:' || count80 ) ; dbms_output.put_line('1981:' || count81 ) ; dbms_output.put_line('1987:' || count87 ) ; end ;
在程序设计中,能不操作数据库就不操作数据库
单元测试, 开发人员做单元测试 ,测试人员做黑河白盒 压力测试