-
pl/sql程序结构查看全部
-
什么事pl/sql查看全部
-
plsql 语句块基本格式,及打开oracle输出开关查看全部
-
java编写demo查看全部
-
plsql查看全部
-
光标属性查看全部
-
分析过程查看全部
-
累加求总工资 set serveroutput on declare cursor cdept is select deptno from dept; pdeptno dept.deptno%type; cursor cemp(dno number) is select sal from emp where deptno=dno; psal emp.sal%type; count1 number; count2 number; count3 number; salTotal number; begin open cdept; loop fetch cdept into pdeptno; exit when cdept%notfound; count1:=0;count2:=0;count3:=0;salTotal:=0; open cemp(pdeptno); loop fetch cemp into psal; exit when cemp%notfound; if psal <3000 then count1:=count1+1; elsif psal>=3000 and psal<6000 then count2:=count2+1; else count3:=count3+1; end if; salTotal:=salTotal+psal; end loop; close cemp; insert into msg values(pdeptno,count1,count2,count3,nvl(salTotal,0)); end loop; close cdept; dbms_output.put_line('统计完成'); commit; end; /查看全部
-
set serveroutput on declare cursor cdept is select deptno from dept; pdeptno dept.deptno%type; cursor cemp(dno number) is select sal from emp where deptno=dno; psal emp.sal%type; count1 number; count2 number; count3 number; salTotal number; begin open cdept; loop fetch cdept into pdeptno; exit when cdept%notfound; count1:=0;count2:=0;count3:=0; select sum(sal) into salTotal from emp where deptno=pdeptno; open cemp(pdeptno); loop fetch cemp into psal; exit when cemp%notfound; if psal <3000 then count1:=count1+1; elsif psal>=3000 and psal<6000 then count2:=count2+1; else count3:=count3+1; end if; end loop; close cemp; insert into msg values(pdeptno,count1,count2,count3,nvl(salTotal,0)); end loop; close cdept; dbms_output.put_line('统计完成'); commit; end; /查看全部
-
捕获例外查看全部
-
什么是例外查看全部
-
带参数的光标查看全部
-
修改光标数目查看全部
-
oracle数据库的四个事务特性,以及给员工涨工资查看全部
-
完整的代码查看全部
举报
0/150
提交
取消