Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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

Oracle ±í¿Õ¼ä»ù±¾²Ù×÷

1. ²éѯÊý¾Ý¿âÏÖÔڵıí¿Õ¼ä
select tablespace_name, file_name, sum(bytes)/1024/1024 table_size from dba_data_files group by tablespace_name,file_name;
2. ½¨Á¢±í¿Õ¼ä
CREATE TABLESPACE data01 DATAFILE '/oracle/oradata/db/DATA01.dbf' SIZE 500M;
3.ɾ³ý±í¿Õ¼ä
DROP TABLESPACE data01 INCLUDING CONTENTS AND DATAFILES;
4. Ð޸ıí¿Õ¼ä´óС
alter database datafile '/path/NADDate05.dbf' resize 100M
5.Ôö¼ÓÊý¾ÝÎļþ
ALTER TABLESPACE NEWCCS ADD DATAFILE '/u03/oradata/newccs/newccs04.dbf' SIZE 4896M;
6. ɾ³ýÊý¾ÝÎļþ
sql>alter database datafile '/path/NADDate05.dbf' OFFLINE  DROP;
±¾ÎÄÀ´×ÔCSDN²©¿Í£ºhttp://blog.csdn.net/tianlesoftware/archive/2009/10/17/4681973.aspx ......

oracle ¼òµ¥µÄ×Ö·û´®²ð·Öº¯Êý

д´æ´¢¹ý³Ìʱ£¬Óõ½²ð·Ö×Ö·û´®£¬µÚÒ»¸ö´«Èë²ÎÊýΪ´ø·Ö¸î·ûµÄ×Ö·û´®£¬µÚ¶þ¸öΪ·Ö¸ô·ûµÄ¸öÊý£¬ÏÂÃæÊǵ¥Ìá³öÀ´µÄ·Ö¸î×Ö·û´®·½·¨£¬
create or replace procedure split(                              
                                i_PageIds in varchar2,             --Ô­Ò³ÃæpageId×飬ÒÔ×Ö·û´®ÐÎʽ´«Èë,È磺1001,1511,
                                i_PageIdsCount in number          --pag ......

Oracle³£ÓÃÎÊÌâ½â´ð

 £¨1£©[Q]ÈçºÎ²åÈëµ¥ÒýºÅµ½Êý¾Ý¿â±íÖÐ
[A]¿ÉÒÔÓÃASCIIÂë´¦Àí£¬ÆäËüÌØÊâ×Ö·ûÈç&Ò²Ò»Ñù£¬Èç
insert into t values('i'||chr(39)||'m'); -- chr(39)´ú±í×Ö·û'
»òÕßÓÃÁ½¸öµ¥ÒýºÅ±íʾһ¸ö
or insert into t values('I''m'); -- Á½¸ö''¿ÉÒÔ±íʾһ¸ö'
 
£¨2£©[Q]Ëæ»ú³éÈ¡Ç°NÌõ¼Ç¼µÄÎÊÌâ
[A]8iÒÔÉÏ°æ±¾
select * from (select * from tablename order by dbms_random.value) where rownum< N;
×¢£ºdbms_random°üÐèÒªÊÖ¹¤°²×°£¬Î»ÓÚ$ORACLE_HOME/rdbms/admin/dbmsrand.sql
dbms_random.value(100,200)¿ÉÒÔ²úÉú100µ½200·¶Î§µÄËæ»úÊý
 
£¨3£©[Q]ÔõôÑù³éÈ¡Öظ´¼Ç¼
[A]select * from table t1 where t1.rowid !=
(select max(rowid) from table t2
where t1.id=t2.id and t1.name=t2.name)
»òÕß
select count(*), t.col_a,t.col_b from table t
group by col_a,col_b
having count(*)>1
Èç¹ûÏëɾ³ýÖظ´¼Ç¼£¬¿ÉÒ԰ѵÚÒ»¸öÓï¾äµÄselectÌ滻Ϊdelete
 
£¨4£©[Q]ÔõôÑùÉèÖÃ×ÔÖÎÊÂÎñ
[A]8iÒÔÉÏ°æ±¾£¬²»Ó°ÏìÖ÷ÊÂÎñ
pragma autonomous_transaction;
……
commit|rollback;
 
£¨5£©[Q]ÔõÃ´Ñ ......

ORACLE ÖÐÈ¥»Ø³µ¡¢¿Õ¸ñ¡¢TABµÄº¯Êý

update EMPLOYEE set BADGE=trim(BADGE);   // ÕâÑù¿ÉÈ¥³ý×Ö·û´®Á½±ßµÄ¿Õ¸ñ
update EMPLOYEE set BADGE=replace(BADGE,' ','');    // ÕâÑùÄÜÈ¥³ýËùÓеĿոñ
SELECT replace(string,chr(13),'')   from DUAL   ----»»ÐÐ
SELECT replace(string,chr(10),'')   from DUAL   ---»Ø³µÊÇchr(10) ......

oracleÖÐsubstrºÍinstrµÄÓ÷¨

ÍøÉÏËѼ¯µÄ£¬ÕûÀíÏÂ
1¡¢substr(string string, int a, int b)
²ÎÊý1:string Òª´¦ÀíµÄ×Ö·û´®
²ÎÊý2£ºa ½ØÈ¡×Ö·û´®µÄ¿ªÊ¼Î»Öã¨ÆðʼλÖÃÊÇ0£©
²ÎÊý3£ºb ½ØÈ¡µÄ×Ö·û´®µÄ³¤¶È(¶ø²»ÊÇ×Ö·û´®µÄ½áÊøλÖÃ)
ÀýÈ磺
substr("ABCDEFG", 0); //·µ»Ø£ºABCDEFG£¬½ØÈ¡ËùÓÐ×Ö·û
substr("ABCDEFG", 2); //·µ»Ø£ºCDEFG£¬½ØÈ¡´ÓC¿ªÊ¼Ö®ºóËùÓÐ×Ö·û
substr("ABCDEFG", 1, 3); //·µ»Ø£ºABC£¬½ØÈ¡´ÓA¿ªÊ¼3¸ö×Ö·û £¬ÕâÀ↑ʼÊÇ1ºÍ3·µ»Ø¶¼ÊÇÒ»¸ö×Ö·û´®
substr("ABCDEFG", 1, 100); //·µ»Ø£ºABCDEFG£¬100ËäÈ»³¬³öÔ¤´¦ÀíµÄ×Ö·û´®×¶È£¬µ«²»»áÓ°Ïì·µ»Ø½á¹û£¬ÏµÍ³°´Ô¤´¦Àí×Ö·û´®×î´óÊýÁ¿·µ»Ø¡£
substr("ABCDEFG", 0, -3); //·µ»Ø£ºEFG£¬×¢Òâ²ÎÊý-3£¬Îª¸ºÖµÊ±±íʾ´Óβ²¿¿ªÊ¼ËãÆð£¬×Ö·û´®ÅÅÁÐλÖò»±ä¡£
2¡¢substr(string string, int a)
²ÎÊý1:string Òª´¦ÀíµÄ×Ö·û´®
²ÎÊý2£ºa ¿ÉÒÔÀí½âΪ´ÓË÷Òýa£¨×¢Ò⣺ÆðʼË÷ÒýÊÇ0£©´¦¿ªÊ¼½ØÈ¡×Ö·û´®£¬Ò²¿ÉÒÔÀí½âΪ´ÓµÚ £¨a+1£©¸ö×Ö·û¿ªÊ¼½ØÈ¡×Ö·û´®¡£
ÀýÈ磺
substr("ABCDEFG", 0); //·µ»Ø£ºABCDEFG, ½ØÈ¡ËùÓÐ×Ö·û
substr("ABCDEFG", 2); //·µ»Ø£ºCDEFG£¬½ØÈ¡´ÓC¿ªÊ¼Ö®ºóËùÓÐ×Ö·û
1.instr
 
ÔÚOracle/PLSQLÖУ¬instrº¯Êý·µ»ØÒª½ ......

Oracle ½Å±¾£¨ÊÊÓ¦¸÷ÖÖÒµÎñÐèÒª£©


1. È¡A±íµÄÊý¾Ý£¬¸üÐÂB±í×Ö¶Î
update  m_build b
set b.district_id=(
  select d.district_id
  from 
    bjhouse.d_district d
  where
    b.build_name_jq=d.district_name)
where exists
  (select 1
  from 
    bjhouse.d_district d
  where
    b.build_name_jq=d.district_name)
......
×ܼǼÊý:3994; ×ÜÒ³Êý:666; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [9] [10] [11] [12] 13 [14] [15] [16] [17] [18]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ