Oracle ÖÐÈçºÎɾ³ýÖظ´Êý¾Ý
ÎÒÃÇ¿ÉÄÜ»á³öÏÖÕâÖÖÇé¿ö£¬Ä³¸ö±íÔÀ´Éè¼Æ²»ÖÜÈ«£¬µ¼Ö±íÀïÃæµÄÊý¾ÝÊý¾ÝÖظ´£¬ÄÇô£¬ÈçºÎ¶ÔÖظ´µÄÊý¾Ý½øÐÐɾ³ýÄØ£¿
Öظ´µÄÊý¾Ý¿ÉÄÜÓÐÕâÑùÁ½ÖÖÇé¿ö£¬µÚÒ»ÖÖʱ±íÖÐÖ»ÓÐijЩ×Ö¶ÎÒ»Ñù£¬µÚ¶þÖÖÊÇÁ½ÐмǼÍêÈ«Ò»Ñù¡£
Ò»¡¢¶ÔÓÚ²¿·Ö×Ö¶ÎÖظ´Êý¾ÝµÄɾ³ý
ÏÈÀ´Ì¸Ì¸ÈçºÎ²éѯÖظ´µÄÊý¾Ý°É¡£
ÏÂÃæÓï¾ä¿ÉÒÔ²éѯ³öÄÇЩÊý¾ÝÊÇÖظ´µÄ£º
select ×Ö¶Î1,×Ö¶Î2,count(*) from ±íÃû group by ×Ö¶Î1,×Ö¶Î2 having count(*) > 1
½«ÉÏÃæµÄ>ºÅ¸ÄΪ=ºÅ¾Í¿ÉÒÔ²éѯ³öûÓÐÖظ´µÄÊý¾ÝÁË¡£
ÏëҪɾ³ýÕâЩÖظ´µÄÊý¾Ý£¬¿ÉÒÔʹÓÃÏÂÃæÓï¾ä½øÐÐɾ³ý
delete from ±íÃû a where ×Ö¶Î1,×Ö¶Î2 in
(select ×Ö¶Î1,×Ö¶Î2,count(*) from ±íÃû group by ×Ö¶Î1,×Ö¶Î2 having count(*) > 1)
ÉÏÃæµÄÓï¾ä·Ç³£¼òµ¥£¬¾ÍÊǽ«²éѯµ½µÄÊý¾Ýɾ³ýµô¡£²»¹ýÕâÖÖɾ³ýÖ´ÐеÄЧÂʷdz£µÍ£¬¶ÔÓÚ´óÊý¾ÝÁ¿À´Ëµ£¬¿ÉÄܻὫÊý¾Ý¿âµõËÀ¡£ËùÒÔÎÒ½¨ÒéÏȽ«²éѯµ½µÄÖظ´µÄÊý¾Ý²åÈëµ½Ò»¸öÁÙʱ±íÖУ¬È»ºó¶Ô½øÐÐɾ³ý£¬ÕâÑù£¬Ö´ÐÐɾ³ýµÄʱºò¾Í²»ÓÃÔÙ½øÐÐÒ»´Î²éѯÁË¡£ÈçÏ£º
CREATE TABLE ÁÙʱ±í AS
(select ×Ö¶Î1,×Ö¶Î2,count(*) from ±íÃû group by ×Ö¶Î1,×Ö¶Î2 having count(*) > 1)
ÉÏÃæÕâ¾ä»°¾ÍÊǽ¨Á¢ÁËÁÙʱ±í£¬²¢½«²éѯµ½µÄÊý¾Ý²åÈëÆäÖС£
ÏÂÃæ¾Í¿ÉÒÔ½øÐÐÕâÑùµÄɾ³ý²Ù×÷ÁË£º
delete from ±íÃû a where ×Ö¶Î1,×Ö¶Î2 in (select ×Ö¶Î1£¬×Ö¶Î2 from ÁÙʱ±í);
ÕâÖÖÏȽ¨ÁÙʱ±íÔÙ½øÐÐɾ³ýµÄ²Ù×÷Òª±ÈÖ±½ÓÓÃÒ»ÌõÓï¾ä½øÐÐɾ³ýÒª¸ßЧµÃ¶à¡£
Õâ¸öʱºò£¬´ó¼Ò¿ÉÄÜ»áÌø³öÀ´Ëµ£¬Ê²Ã´£¿Äã½ÐÎÒÃÇÖ´ÐÐÕâÖÖÓï¾ä£¬ÄDz»ÊÇ°ÑËùÓÐÖظ´µÄÈ«¶¼É¾³ýÂ𣿶øÎÒÃÇÏë±£ÁôÖظ´Êý¾ÝÖÐ×îеÄÒ»Ìõ¼Ç¼°¡£¡´ó¼Ò²»Òª¼±£¬ÏÂÃæÎҾͽ²Ò»ÏÂÈçºÎ½øÐÐÕâÖÖ²Ù×÷¡£
ÔÚoracleÖУ¬ÓиöÒþ²ØÁË×Ô¶¯rowid£¬ÀïÃæ¸øÿÌõ¼Ç¼һ¸öΨһµÄrowid£¬ÎÒÃÇÈç¹ûÏë±£Áô×îеÄÒ»Ìõ¼Ç¼£¬
ÎÒÃǾͿÉÒÔÀûÓÃÕâ¸ö×ֶΣ¬±£ÁôÖظ´Êý¾ÝÖÐrowid×î´óµÄÒ»Ìõ¼Ç¼¾Í¿ÉÒÔÁË¡£
ÏÂÃæÊDzéѯÖظ´Êý¾ÝµÄÒ»¸öÀý×Ó£º
select a.rowid,a.* from ±íÃû a
where a.rowid !=
(
select max(b.rowid) from ±íÃû b
where a.×Ö¶Î1 = b.×Ö¶Î1 and
a.×Ö¶Î2 = b.×Ö¶Î2
)
ÏÂÃæÎÒ¾ÍÀ´½²½âһϣ¬ÉÏÃæÀ¨ºÅÖеÄÓï¾äÊDzéѯ³öÖظ´Êý¾ÝÖÐrowid×î´óµÄÒ»Ìõ¼Ç¼¡£
¶øÍâÃæ¾ÍÊDzéѯ³ö³ýÁËrowid×î´óÖ®ÍâµÄÆäËûÖظ´µÄÊý¾ÝÁË¡£
ÓÉ´Ë£¬ÎÒÃÇҪɾ³ýÖظ´Êý¾Ý£¬Ö»±£Áô×îеÄÒ»ÌõÊý¾Ý£¬¾Í¿ÉÒÔÕâÑùдÁË£º
delete from ±íÃû a
where a.rowid !=
(
select max(b.rowid) from ±íÃû b
where a.×Ö¶Î1 = b.×Ö¶Î1
Ïà¹ØÎĵµ£º
ÓÃoracle¶ÁÈ¡±¾µØÎļþ
Ê×ÏÈÒªÔÚoracleÖд´½¨Îļþ¼Ð£¬È»ºó¸³ÓèÏàÓ¦µÄ¶ÁдȨÏÞ£¬È»ºóÊý¾Ý¿â²ÅÄܶÁȡϵͳÖеÄÎļþ
--´´½¨Îļþ¼Ð ²¢¸³ÓèȨÏÞ¸øÓû§
create or replace directory DIRNAME as 'D:\skybook2';
grant read,write on directory DIRNAME as to USERNAME;
GRANT EXECUTE ON utl_file TO USERNAME;
´´½¨³É¹¦¿ÉÒÔ² ......
½¨Á¢ÁÙʱ±í½á¹¹
create global temporary table myemp as select * from emp;
Ð޸ıí½á¹¹
alter table dept modify (Dname char(20));
alter table dept add (headcount number(3));
¸´ÖÆÒ»¸ö±í
create table emp3 as select * from emp;
²ÎÕÕij¸öÒÑ´æÔÚµÄ±í½¨Á¢Ò»¸ö±í½á¹¹£¬²»ÐèÒªÊý¾Ý
create table emp4 as selec ......
×¢: ÕâÊǸöÈË¿´OracleÊÓƵʱдϵıʼÇ, ¶àÓдíÎó, Íû¸÷λÇÐÎðÁßϧ´Í½Ì.
1. Dos
ϵǽ³¬¼¶¹ÜÀíÔ±
£º
sqlplus sys/
ÃÜÂë
as sysdba
2.
¸ü¸Ä¹ÜÀíÔ±
£º
alter user scott account unlock;
3.
Êý¾ÝµÄ±¸·Ý
.
A
µ¼³ö
:
Cmd
ÏÂ
: ......
½ñÌìÁ˽âÁËһϿªÔ´dspaceÈí¼þ£¬ÏÖ½«°²×°¹ý³Ì×ܽáÈçÏ£º
1¡¢»·¾³ÉèÖÃ
1.1 ÏÂÔØjdk1.6.x²¢°²×°,°²×°Ê±Ñ¡ÔñĬÈÏ°²×°Â·¾¶¼´¿É
Ò»°ãΪ C:\Program Files\Java\jdk1.6.0_10
ÉèÖÃJAVA_HOME,ÉèÖÃCLASSPATHºÍPATH
2¡¢×é¼þ×¼±¸
......
SQLProgressÊÇÒ»¸öСÇɵIJÙ×÷Êý¾Ý¿âµÄ¹¤¾ß£¬ËùÓеİ汾¶¼²»³¬¹ý3M£¬°üÀ¨ÏÖÔÚ×îеÄ34°æ±¾¡£33ÒÔ¼°ÒÔÇ°µÄ°æ±¾ÐèÒª°²×°BDE²ÅÄÜÔËÐУ¬´Ó34¿ªÊ¼£¬Ö»Ö§³ÖOracleÊý¾Ý¿â£¬²ÉÓÃODAC×÷ΪÊý¾Ý¿â·ÃÎʵĽӿڣ¬Ö»ÐèÒªÒ»¸ö²»µ½3MµÄ¿ÉÖ´ÐÐÎļþ¾Í¿ÉÒÔ¶ÔÊý¾Ý¿â½øÐвÙ×÷£¬ÆäËûʲô¶¼Óð²×°¡£¸Ã°æ±¾ÊÇÔÚSQLProgress1.01.33»ù´¡ÉÏÐ޸ĵģ¬33ÊÇBD ......