如题
解决方案 »
- 关于专有连接UGA的简单问题
- 提问的智慧补充
- 求助!oracle数据库如何保存SQL语句!
- oracle sql 语法图 能附上图讲解大概怎么看吗?都基本有哪些可看性?(不同图型代表什么寓意)
- 数据库oracle 系统表数据删掉 怎样才能恢复表的数据
- 如何启动ORACLE的EM ,10G中
- 如何得到select后各行的标志(如当前行,前一行,后一行)?
- 求一个调查结果统计的SQL,百分感谢
- 请问在VB中如何编写SQL语句获得ORACLE数据库中某个表的表结构以及主键,外键的信息,谢谢!
- 我想用一个给定的关键字去匹配一个blob型的字段,请问该如何作
- 请教关于RMAN的问题
- imp导入到最后一个表时速度特别慢
多看看提问的智慧!
oracle 版本未知?
问题描述不清楚?
create or replace package salpkg as
type deptsal_rec is record(deptno emp.deptno%type, sal emp.sal%type);
type deptsalset is table of deptsal_rec;
type dept_maxsalset is table of emp.sal%type index by pls_integer;
procedure maxsal(deptsal in deptsalset);
end salpkg;
/
-----包体,是过程maxsal的实现,三个for循环,第一个是初始化,第二个找出最高工资,第三个打印----create or replace package body salpkg as
procedure maxsal(deptsal in deptsalset) is
deptmaxsal dept_maxsalset;
cursor dept_cur is select distinct deptno from emp;
begin
for i in deptsal.first..deptsal.last
loop
deptmaxsal(i.deptno) :=0;
end loop;
for i in deptsal.first..deptsal.last
loop
if i.sal > deptmaxsal(i.deptno)then
deptmaxsal(i.deptno) :=i.sal;
end if;
end loop;
for i in dept_cur
loop
dbms_output.put_line(deptmaxsal(i.deptno));
end loop;
end;
end;
/
另:emp表中的deptno是number类型,能不能做关联数组的小标,number类型和pls_integer类型可不可以互相转换???