这个是狙狙的sql解法。
http://blog.csdn.net/happyflystone/archive/2009/01/17/3819863.aspx
引用需求
今天和梁翁在群里聊天,小家伙突然抛出一个有意思的问题,那就是字符串字段内的字符串排序问题,比如有列 col, 有数据 'RDGS' , 要求输出为 'DGRS' 。
--------------------------------------------------------------------------------
oracle分析函数支持聚合:)
create table t_test(f varchar2 ( 10 ));
insert into t_test values ( 'sdffesa' );
insert into t_test values ( 'asdflkj' );
insert into t_test values ( 'ijf92' );
select f, max ( replace (SYS_CONNECT_BY_PATH(c, ' ' ), ' ' , '' ))f1 from (
select f,rn,c,row_number()over( partition by f order by c) as ord from ( select
f,decode(rn,
1 ,substr(f, 1 , 1 ),
2 ,substr(f, 2 , 1 ),
3 ,substr(f, 3 , 1 ),
4 ,substr(f, 4 , 1 ),
5 ,substr(f, 5 , 1 ),
6 ,substr(f, 6 , 1 ),
7 ,substr(f, 7 , 1 ),
8 ,substr(f, 8 , 1 ),
9 ,substr(f, 9 , 1 ),
10 ,substr(f, 10 , 1 )
) as c,rn from
t_test a ,(
select level rn from dual connect by 1 = 1 and level <= 10 )b
where length(a.f)>=b.rn))
start with ord= 1 connect by f= prior f and ord- 1 = prior ord
group by f;
drop table t_test;
/*
F F1
ijf92 29fij
asdflkj adfjkls
sdffesa adeffss
*/
--------------------------------------------------------------------------------
后来受到小梁的启发,修改了一下拆分字符串的方法,可以把decode去掉
-- 测试环境
create table t_test(f varchar2 ( 10 ));
insert into t_test values ( 'sdffesa' );
insert into t_test values ( 'asdflkj' );
insert into t_test values ( 'ijf92' );
-- 测试字符串的拆分
select
f,substr(f,rn, 1 ) as c from
t_test a ,(
select level rn from dual connect by 1 = 1 and level <= 10 )b
where length(a.f)>=b.rn order by f;
/*
F C
asdflkj a
asdflkj f
asdflkj &n
windows上存在32bit的限制,如AIX、HP UNIX 等有明确的64BIT OS and ORACLE的版本,32bit oracle可以装在64bit os 上,64 bit oracle不能装在32 bit OS上
oracle是64bit or 32 bit,32bit 通常 SGA有 1.7G 的限制(某些OS的处理或者WINDOWS上有特定设定可以支持到2G以上甚至达到3.7G
如何查出前台正在发出的sql语句:
sele ......
'-------------------------------------------------------------------以下是登录代码
<%@ page contentType="text/html; charset=gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3 ......
自己在做这个程序的时候看过很多的资料,上网也查了不少的资料,可是多半说的是出神入化,云里雾里...不光看了不明白,而且是有明白一点的人,看了也变的有些模糊了。
这里我掩饰一套完整的java jdbc 连接Oracle9i的范例。
package com.lxh.dbcon;//打包
import ......