易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : Oracle

JDBC存取ORACLE大型数据对象LOB几种情况的示范类

      import Java.io.*;
  import java.util.*;
  import java.sql.*;
  public class LobPros
  {
  /**
  * Oracle驱动程序
  */
  private static final String DRIVER = "oracle.jdbc.driver.OracleDriver";
  /**
  * ORACLE连接用URL
  */
  private static final String URL = "jdbc:oracle:thin:@test2000:1521:orac";
  /**
  * 用户名
  */
  private static final String USER = "user";
  /**
  * 密码
  */
  private static final String PASSWord = "pswd";
  /**
  * 数据库连接
  */
  private static Connection conn = null;
  /**
  * SQL语句对象
  */
  private static Statement stmt = null;
  /**
  * @roseuid 3EDA089E02BC
  */
  public LobPros()
  {
  }
  /**
  * 往数据库中插入一个新的CLOB对象
  *
  * @param infile - 数据文件
  * @throws java.lang.Exception
  * @roseuid 3EDA04A902BC
  */
  public static void clobInsert(Stri ......

oracle 分区拆分 不能插入数据 01502 索引失效

数据表day_energy当前为月分区表,分区信息如下:DE_200912,DE_201001,DE_201002.....,月分区表出现速度查询慢,因此通过建立日分区表进行改善。
拆分月分区表的语句为:
alter table day_energy split partition de_201001 at('20100102') into (partition de_20100101,partition de_20100102)
分析:
alter table 表名 split partition 分区名 at (分割日期) into (新分区1,新分区2);
如果简单的分区1个月的表,比较简单,但是如果要拆分一年的表,那就太复杂了。为了简单实现所以就通过以下这个过程进行批量拆分:
-- czc 拆分分区表
--将月分区表拆分成日分区表
declare
  v_tbl     varchar2(56);
  v_partion varchar2(56);
  datetime  date;
  v_sql     varchar2(1024);
  v_dt0     varchar2(8);
  v_dt1     varchar2(8); 
begin
  datetime:=to_date('2010-11-1','yyyy-MM-dd');
  v_tbl:='day_energy';
  while to_char(datetime,'yyyyMMdd')!='20110101' loop
     if t ......

Oracle的rownum原理和使用

原文出自:http://tenn.javaeye.com/blog/99339
在Oracle
中,要按特定条件查询前N条记录,用个rownum
就搞定了。 
select * from emp where rownum
 <= 5 
而且书上也告诫,不能对rownum
用">",这也就意味着,如果你想用
 
select * from emp where rownum
 > 5 
则是失败的。要知道为什么会失败,则需要了解rownum
背后的机制: 
1 Oracle
 executes your query.
2 Oracle
 fetches the first row and calls it row number 1.
3 Have we gotten past row number meets the criteria? If no, then Oracle
 discards the row, If yes, thenOracle
 return the row.
4 Oracle
 fetches the next row and advances the row number (to 2, and then to 3, and then to 4, and so forth).
5 Go to step 3.
了解了原理,就知道rownum
>不会成功,因为在第三步的时候查询出的行已经被丢弃,第四步查出来的rownum
仍然是1,这样永远也不会成功。
同样道理,rownum
如果单独用=,也只有在rownum
=1时才有用。
对于rownum
来说它是ora ......

SQL Server和Oracle的常用函数对比

---------数学函数
1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.取整(截取)
S:select cast(-1.002 as int) value
O:select trunc(-1.002) value from dual
5.四舍五入
S:select round(1.23456,4) value 1.23460
O:select round(1.23456,4) value from dual 1.2346
6.e为底的幂
S:select Exp(1) value 2.7182818284590451
O:select Exp(1) value from dual 2.71828182
7.取e为底的对数
S:select log(2.7182818284590451) value 1
O:select ln(2.7182818284590451) value from dual; 1
8.取10为底对数
S:select log10(10) value 1
O:select log(10,10) value from dual; 1
9.取平方
S:select SQUARE(4) value 16
O:select power(4,2) value from dual 16
10.取平方根
S:select SQRT(4) value 2
O:select SQRT(4) value from dual 2
11.求任意数为底的幂
S:select power(3,4) value 81
O:select power(3,4) value from dual 81
12.取随机数 ......

SQL Server和Oracle的常用函数对比

---------数学函数
1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.取整(截取)
S:select cast(-1.002 as int) value
O:select trunc(-1.002) value from dual
5.四舍五入
S:select round(1.23456,4) value 1.23460
O:select round(1.23456,4) value from dual 1.2346
6.e为底的幂
S:select Exp(1) value 2.7182818284590451
O:select Exp(1) value from dual 2.71828182
7.取e为底的对数
S:select log(2.7182818284590451) value 1
O:select ln(2.7182818284590451) value from dual; 1
8.取10为底对数
S:select log10(10) value 1
O:select log(10,10) value from dual; 1
9.取平方
S:select SQUARE(4) value 16
O:select power(4,2) value from dual 16
10.取平方根
S:select SQRT(4) value 2
O:select SQRT(4) value from dual 2
11.求任意数为底的幂
S:select power(3,4) value 81
O:select power(3,4) value from dual 81
12.取随机数 ......

sql server和oracle行转列的一种典型方法

sql server和oracle行转列的一种典型方法
前言:网上有不少文章是讲行转列的,但是大部分都是直接贴代码,忽视了中间过程,本人自己思考了下为什么要这样实现,并且做了如下的笔记,对有些懂的人来说可能没有价值,希望对还不懂的人有一点借鉴意义。
对于有些业务来说,数据在表中的存储和其最终的Grid表现恰好相当于把源表倒转,那么这个时候我们就碰到了如何把行转化为列的问题,为了简化问题,我们且看如下查询出来的数据,您不必关心表的设计以及sql语句:

假设用到的sql语句为:
SELECT [姓名],[时代],[金钱]
  from [test].[dbo].[people]  
这个表存储了两个人在不同时代(时代是固定的三个:年轻、中年和老年)拥有的金币,其中:
张三在年轻、中年和老年时期分别拥有1000、5000、800个金币;
李四在年轻、中年和老年时期分别拥有1200、6000、500个金币。
现在我们想把两人在不同阶段拥有的金币用类似如下的表格来展现:
姓名
年轻
中年
老年
张三
1000
5000
800
李四
1200
6000
500
我们现在考虑用最简单和直接的办法来实现,其实关键是如何创建那些需要增加的列,且如何设定其值,现在我们来创建“年 ......

sql server和oracle行转列的一种典型方法

sql server和oracle行转列的一种典型方法
前言:网上有不少文章是讲行转列的,但是大部分都是直接贴代码,忽视了中间过程,本人自己思考了下为什么要这样实现,并且做了如下的笔记,对有些懂的人来说可能没有价值,希望对还不懂的人有一点借鉴意义。
对于有些业务来说,数据在表中的存储和其最终的Grid表现恰好相当于把源表倒转,那么这个时候我们就碰到了如何把行转化为列的问题,为了简化问题,我们且看如下查询出来的数据,您不必关心表的设计以及sql语句:

假设用到的sql语句为:
SELECT [姓名],[时代],[金钱]
  from [test].[dbo].[people]  
这个表存储了两个人在不同时代(时代是固定的三个:年轻、中年和老年)拥有的金币,其中:
张三在年轻、中年和老年时期分别拥有1000、5000、800个金币;
李四在年轻、中年和老年时期分别拥有1200、6000、500个金币。
现在我们想把两人在不同阶段拥有的金币用类似如下的表格来展现:
姓名
年轻
中年
老年
张三
1000
5000
800
李四
1200
6000
500
我们现在考虑用最简单和直接的办法来实现,其实关键是如何创建那些需要增加的列,且如何设定其值,现在我们来创建“年 ......

Oracle Finalizes Acquisition of Sun


We are pleased to announce that Oracle has completed its acquisition of Sun Microsystems and Sun is now a wholly owned subsidiary of Oracle. With this news, we want to reiterate our commitment to deliver complete, open and integrated systems that help our customers improve the performance, reliability and security of their IT infrastructure. We would also like to thank the many customers that have supported us throughout the acquisition process.
There is no doubt that this combination transforms the IT industry. With the addition of servers, storage, SPARC processors, the Solaris operating system, Java, and the MySQL database to Oracle s portfolio of database, middleware, and business and industry applications, we plan to engineer and deliver open and integrated systems - from applications to disk - where all the pieces fit and work together out of the box.
Performance levels will be unmatched. Oracle s software already runs faster on Sun SPARC/Solaris than on any other server or o ......
总记录数:3994; 总页数:666; 每页6 条; 首页 上一页 [269] [270] [271] [272] 273 [274] [275] [276] [277] [278]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号