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

ORACLE分析函数的用法

开窗函数的的理解:
开窗函数指定了分析函数工作的数据窗口大小,这个数据窗口大小可能会随着行的变化而变化,举例如下:
over(order   by   salary) 按照salary排序进行累计,order   by是个默认的开窗函数
over(partition   by   deptno)按照部门分区
over(order   by   salary   range   between   50   preceding   and   150   following)
每行对应的数据窗口是之前行幅度值不超过50,之后行幅度值不超过150
over(order   by   salary   rows   between   50   preceding   and   150   following)
每行对应的数据窗口是之前50行,之后150行
over(order   by   salary   rows   between   unbounded   preceding   and   unbounded   following)
每行对应的数据窗口是从第一行到最后一行,等效:
over(order   by   salary   range   between   unbounded   preceding   and   unbounded   following)
主要参考资料:《expert   one-on-one》   Tom   Kyte   《Oracle9i   SQL   Reference》第6章
AVG  
功能描述:用于计算一个组和数据窗口内表达式的平均值。
SAMPLE:下面的例子中列c_mavg计算员工表中每个员工的平均薪水报告,该平均值由当前员工和与之具有相同经理的前一个和后一个三者的平均数得来;
SELECT   manager_id,   last_name,   hire_date,   salary,
AVG(salary)   OVER   (PARTITION   BY   manager_id   ORDER   BY   hire_date  
ROWS   BETWEEN   1   PRECEDING   AND   1   FOLLOWING)   AS   c_mavg
from   employees;
MANAGER


相关文档:

Oracle 异常

Oracle异常分为3种:
(1)预定义异常:no_data_found等,是Oracle系统定义的异常.
declare
  s_test varchar2
begin
  select id into s_test from test; --此时test表无数据
exception
  when no_data_found then
    raise_application_error(-20001, '没有数据');
end;
(2)自� ......

Oracle connection strings

Oracle ODBC connection strings
Open connection to Oracle database using ODBC
"Driver= {Microsoft ODBCforOracle};Server=Your_Oracle_Server.world;Uid=Your_Username;Pwd=Your_Password;"
Oracle OLE DB & OleDbConnection (.NET framework) connection strings
Open connection to Oracle database with s ......

oracle C# SQL 语句

在VS中写SQL语句的时候,千万万千要小心再小心,比如 说 数据类型的匹配, 单引号(这个能把人迷死)
 where 子句中可千万不能有空格(当查询条件为字符串的时候能把你弄疯,我弄这个的时候都疯了几次了,什么都对就是查不出来,调试了N遍才发现。)不行了,吃饭去,再不吃看见活人都想咬了。 ......

Oracle 日志文件错误的处理。

转自:http://hi.baidu.com/dashuaiwang/blog/item/47cc680ec35055c37acbe1f8.html
打开oracle 数据库时出现了错误:
ORA-00313: 无法打开日志组 1 (线程 1) 的成员
ORA-00312: 联机日志 1 线程 1: 'D:\ORACLE\ORADATA\GOCOM\REDO01.LOG'
SQL> connect / as sysdba;
已连接。
SQL> shutdown immediate;
ORA- ......

oracle不可更新的试图

关键词:with read only
作用:用于指定所创建的试图不可以通过本视图更新表
执行一下SQL,创建表T,和两个试图V1,V2:
CREATE TABLE T(ID INTEGER);
CREATE VIEW V1 AS SELECT * from T;
CREATE VIEW V2 AS SELECT * from T WITH READ ONLY;
执行SQL:
INSERT INTO V1 VALUES(1);
--------------------
1 row cre ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号