当前位置:Gxlcms > 数据库问题 > PL/SQL实例

PL/SQL实例

时间:2021-07-01 10:21:17 帮助过:4人阅读

set SERVEROUTPUT ON; 2 declare 3 cursor cemp is select to_char(hiredate,yyyy) from emp; 4 phiredate VARCHAR2(4); 5 count80 number:=0; 6 count81 number:=0; 7 count82 number:=0; 8 count83 number:=0; 9 begin 10 open cemp; 11 loop 12 fetch cemp into phiredate; 13 exit when cemp%notfound; 14 if phiredate=1980 then count80:=count80+1; 15 elsif phiredate=1981 then count81:=count81+1; 16 elsif phiredate=1982 then count82:=count82+1; 17 else count83:=count83+1; 18 end if; 19 end loop; 20 close cemp; 21 dbms_output.put_line(total:||(count80+count81+count82+count83)); 22 end; 23 /

 

PL/SQL实例

标签:har   oop   统计   red   cursor   bsp   not   select   code   

人气教程排行