Óú¯ÊýʵÏÖoracleµÄsys_connect_by_path¹¦ÄÜ
1.½¨±í£¬²åÈëÊý¾Ý
create table dept(deptno number,deptname varchar2(20),mgrno number);
insert into dept values(1,'×ܹ«Ë¾',null);
insert into dept values(2,'Õã½·Ö¹«Ë¾',1);
insert into dept values(3,'º¼ÖÝ·Ö¹«Ë¾',2);
insert into dept values(4,'ºþ±±·Ö¹«Ë¾',1);
insert into dept values(5,'Î人·Ö¹«Ë¾',4);
2.oracle²éѯÓï¾ä
select *,sys_connect_by_path(deptname,'/') deptname from dept
start with mgrno is null connect by prior deptno=mgrno;
----------------------------------------------------------------------------------------
1 ×ܹ«Ë¾ <NULL> /×ܹ«Ë¾
2 Õã½·Ö¹«Ë¾ 1 /×ܹ«Ë¾/Õã½·Ö¹«Ë¾
3 º¼ÖÝ·Ö¹«Ë¾ 2 /×ܹ«Ë¾/Õã½·Ö¹«Ë¾/º¼ÖÝ·Ö¹«Ë¾
4 ºþ±±·Ö¹«Ë¾ 1 /×ܹ«Ë¾/ºþ±±·Ö¹«Ë¾
5 Î人·Ö¹«Ë¾ 4 /×ܹ«Ë¾/ºþ±±·Ö¹«Ë¾/Î人·Ö¹«Ë¾
----------------------------------------------------------------------------------------
3.´´½¨º¯ÊýʵÏÖÀàËƹ¦ÄÜ
CREATE or replace FUNCTION Branch
( vdeptname varchar(200),
vDelimiter IN VARCHAR(10) DEFAULT '/')
return varchar(4000)
as
c1 cursor;
temp varchar(4000);
vename varchar(200);
begin
temp=vDelimiter;
open c1 for select deptname from dept start with deptname
=vdeptname connect by deptno= prior mgrno;
loop
FETCH
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
OracleÖг£ÓõÄÃüÁîºÍº¯Êý£¬×ö¸öÕûÀí£¬ÒÔ±¸ÒÔºóÓõ½£¬·½±ã²éÔÄ¡£
³£ÓÃÃüÁ
Á¬½Ósqlplus
ÃüÁîÐÐÏÂÔËÐÐcmd½øÈ룬ÈçÒÔsysģʽµÇ½£¬ÃüÁîÈçÏ£º
(1).sqlplus "sys/zhb126 as sysdba"
(2).sqlplus/nolog connect sys/zhb126 as sysdba
(3).sqlplus scott ......
oracle+jspÖÐblobÀàÐÍ´æ´¢´óÎı¾ÎÊÌâ½â¾ö·½·¨
oracle ´æ´¢´óÎı¾Ò»Ö±ÊÇÒ»¸ö¼¬ÊÖµÄÎÊÌâ¡£
Ò»¡¢´æÊý¾Ý¿â£º
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
//¶¨Òå±äÁ¿
java.sql.Connection conn; //Êý¾ ......
DBVERIFY¹¤¾ßµÄÖ÷ҪĿµÄÊÇΪÁ˼ì²éÊý¾ÝÎļþµÄÎïÀí½á¹¹£¬°üÀ¨Êý¾ÝÎļþÊÇ·ñË𻵣¬ÊÇ·ñ´æÔÚÂß¼»µ¿é£¬ÒÔ¼°Êý¾ÝÎļþÖаüº¬ºÎÖÖÀàÐ͵ÄÊý¾Ý¡£
DBVERIFY¹¤¾ß¿ÉÒÔÑéÖ¤ONLINE»òOFFLINEµÄÊý¾ÝÎļþ¡£²»¹ÜÊý¾Ý¿âÊÇ·ñ´ò¿ª£¬¶¼¿ÉÒÔ·ÃÎÊÊý¾ÝÎļþ¡£
1.¿ÉÒÔʹÓðïÖú²é¿´dbvµÄÃüÁî²ÎÊý
C:\>dbv help=y
DBVERIFY: Release 11. ......
ÔÚORACLE Êý¾Ý¿âµÄ¿ª·¢»·¾³ºÍ²âÊÔ»·¾³ÖУ¬Êý¾Ý¿âµÄÈÕ־ģʽºÍ×Ô¶¯¹éµµÄ£Ê½Ò»°ã¶¼ÊDz»ÉèÖõģ¬ÕâÑùÓÐÀûÓÚϵͳӦÓõĵ÷Õû£¬Ò²ÃâµÄÉú³É´óÁ¿µÄ¹éµµÈÕÖ¾Îļþ½«´ÅÅÌ¿Õ¼ä´óÁ¿µÄÏûºÄ¡£µ«ÔÚϵͳÉÏÏߣ¬³ÉΪÉú²ú»·¾³Ê±£¬½«ÆäÉèÖÃΪÈÕ־ģʽ²¢×Ô¶¯¹éµµ¾ÍÏ൱ÖØÒªÁË£¬ÒòΪ£¬ÕâÊDZ£Ö¤ÏµÍ³µÄ°²È«ÐÔ£¬ÓÐЧԤ·ÀÔÖÄѵÄÖØÒª´ëÊ©¡£ÕâÑù£¬Í¨¹ý¶¨Ê ......