易截截图软件、单文件、免安装、纯绿色、仅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过程、函数

过程、函数
 
 
 
create or replace procedure p1
is
  empname emp.ename%type;
begin
  select ename into empname from emp where empno=7788;
  dbms_output.put_line(empname);
end;
 
SQL> ed
SQL> /
 
Procedure created
 
SQL> exec p1; ......

ORACLE数据库对象——同义词、序列、视图

ORACLE数据库对象
——同义词、序列、视图
同义词:同义词是现有对象的别名
简化SQL语句
隐藏对象的名称和所有者
提供对对象的公共访问
 
同义词分为私有同义词和公有同义词
私有同义词只能在其模式内访问,且不能与当前模式的对象同名。
公有同义词可被所有的数据库用户访问。
 
以 SYS 用 ......

读取oracle blob字符串

OleDbConnectioncon=newOleDbConnection(cnnstr);
try
{
con.Open();
}
catch
{}
OleDbCommandcmd=newOleDbCommand(strSQL,con);
System.Data.OleDb.OleDbDataReaderdr=cmd.ExecuteReader();
while(dr.Read())
 
{
stringdd=dr["gggg"].ToString();
byte[]ooo=(byte[])dr["hhhh"];
stringstr;
str=Sys ......

Oracle SQL PLUS 登录 启动 关闭


Oracle SQL PLUS 基本操作1
登录
c:\>sqlplus "sys/test1234 as sysdba"  以sysdba身份登录
 
c:\>sqlplus/nolog   以nolog身份登录
sql> connect sys/test1234 as sysdba
Connected.
 
 
启动 
SQL>  startup    &nb ......

oracle临时表

在Oracle8i或以上版本中,可以创建以下两种临时表:
1。会话特有的临时表
    CREATE GLOBAL TEMPORARY <TABLE_NAME> (<column specification>)
    ON COMMIT PRESERVE ROWS;
 
2。事务特有的临时表
    CREATE GLOBAL TEMPORARY <TABLE_N ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号