易截截图软件、单文件、免安装、纯绿色、仅160KB

ORACLE用LIMIT实现类似分页

练习了ORACLE类似的分页,目的:ORACLE的LIMIT使用
declare
type name_arrary_type is varray(20) of varchar2(10);
name_arrary  name_arrary_type;
rowss int:=&输入页记录数;
dpno int:=&输入部门号;
v_count int:=0;
cursor  emp_cursor(dpno int) is select ename from emp where deptno=dpno;
begin
open emp_cursor(dpno);
loop
fetch emp_cursor bulk collect into name_arrary limit rowss;
dbms_output.put_line('部门'||dpno||'员工:');
for i in 1..(emp_cursor%rowcount-v_count) loop
dbms_output.put_line(i||'    '||name_arrary(i)||'  ');
end loop;
dbms_output.put_line('当前页数:'||(v_count/rowss+1));
dbms_output.new_line;
v_count :=emp_cursor%rowcount;
exit when emp_cursor%notfound;
end loop;
dbms_output.put_line('每页['||rowss||']条记录,总页数:['||ceil(emp_cursor%rowcount/rowss)||']');
close emp_cursor;
end;
运行结果:
部门20员工:
1    SMITH 
2    JONES 
3    SCOTT 
4    ADAMS 
当前页数:1
部门20员工:
1    FORD  
2    YA_PING 
当前页数:2
每页[4]条记录,总页数:[2]


相关文档:

ORACLE游标

ORACLE游标
游标:容器,存放当前SQL语句影响的记录
       所有DML语句都会用到游标
      
       逐行处理影响的行数
 
游标
       静态游标:游标与SQL语句在运行前关联
&nb ......

ORACLE触发器

触发器
 
q      触发器是当特定事件出现时自动执行的存储过程
q      特定事件可以是执行更新的DML语句和DDL语句
q      触发器不能被显式调用
q      触发器的功能:
q      ......

oracle PK问题

我列出我全部的做法:

table a 有id1, str1, str2, str3


开始的pk是id1, str1, str2
希望改成id1, str1, str3
--问题
小弟先有如下问题:

一个表原来的PK是 id1+str1+str2 列
先修改成id1+str1+str3列
而这三列现在当前数据库的数据有重复的情况, 小弟现在用sql:
ALTER table a a ......

Oracle 操作函数

函数:
 1.使用Create Function 语句创建
 2.语
法:
     Create or replace Function  函数名[参数列表]
     Return  数据类型
IS|AS
            局部变量
     Be ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号