Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

oracle×ܽá

²éѯ£ºselectÓï¾ä£¬¶à±í²éѯ£¬group by ·Ö×飬having ¶Ô·Ö×éºóµÄÿһ¸ö×é½øÐйýÂË£¬order by ÅÅÐò¡£(selectÓï¾ä¶à±í²éѯÕâ¸ö×îÖØÒª)
DMLÓï¾ä£ºinsert into emp() values(),insert into emp (select * from emp2),
    delete from emp where...
    update emp set sal =.. where ..
rollback;»Ö¸´¾ÉÓÐÊý¾Ý
TansactionÊÂÎñ£ºÖ÷ÒªÊÇcommitÎÊÌâ
DDLÓï¾ä£ºcreate table ±íÃû£¨Êý¾Ý£©
    create view v$_ÊÔͼÃû£¨Êý¾Ý£©
    create index Ë÷ÒýÃû on ±íÃû(×Ö¶Î)£»
±íµÄÔ¼ÊøÌõ¼þ£º1.not null 2.unique 3.primary 4.foreign 5.check
Ð޸ıí½á¹¹£ºalter table ±íÃû add(×Ö¶Î);
    alter table ±íÃû modify(×Ö¶Î);
    alter table ±íÃû drop(×Ö¶Î)£»
    alter table ±íÃû add constrain Ô¼ÊøÌõ¼þ£»
    alter table ±íÃû drop constrain Ô¼ÊøÌõ¼þ£»
ɾ³ý±í£ºdrop table ±íÃû£»
ɾÊÓͼ£ºdrop view ÊÓͼÃû£»
ɾË÷Òý£ºdrop index Ë÷ÒýÃû£»
´´½¨ÐòÁУº(ʵÏÖ´úÀíÖ÷¼ü)
Àý×Ó£ºcreate sequence ÐòÁÐÃû start with 1 increament by 1;
    ÐòÁÐÃû.currval £º µÃµ½µ±Ç°µÄÐòÁкţ»
    ÐòÁÐÃû.nextval : µÃµ½ÏÂÒ»¸öÐòÁкţ»
µÚÒ»·¶Ê½£ºÒªÓÐÖ÷¼ü£¬Áв»¿É·Ö£»
µÚ¶þ·¶Ê½£ºÂú×ãµÚÒ»·¶Ê½£¬ÇÒ ²»´æÔÚ²¿·ÖÒÀÀµ£»
µÚÈý·¶Ê½£ºÂú×ãµÚ¶þ·¶Ê½£¬ÇÒ ²»´æÔÚ´«µÝÒÀÀµ£»
¶¯Ì¬²úÆ·ÊôÐÔµÄÌí¼Ó£º
±í1£º²úÆ·±í
Id
²úÆ·Ãû
1
Æ»¹û
2
Æû³µ
3
Ò·þ
±í2£ºÊôÐÔ±í£º
Pid
ÊôÐÔÃû
1
ÑÕÉ«
2
Æ·ÖÖ
3
³µÖØ
±í3£º¹Øϵ±í£º
Id
Pid
ÊôÐÔÖµ
1
2
ºÃ
2
3
4¶Ö
3
1
ºì
µ±ÊôÐÔ±íÖж¯Ì¬µÄÌí¼ÓÊôÐÔʱ¾Í²»ÐèÒª¸Ä±ä²úÆ·±íÁË£»ÕâÑù²úÆ·±íºÍÊôÐÔ±í¾Í¿ÉÒÔÏ໥¶ÀÁ¢ÁË£»
pL/SQLÓï¾ä²Î¿¼µÚÎåÕÂchapter_5
ÓαêµÄ¹Ø¼ü×Ö£ºcursor£º´æ´¢µÄÊÇÊý¾ÝµÄ½á¹û¼¯ºÏ£»
Ê÷×´ÏÔʾ——1£¬pid£¨parent_id£©,id,rootid £»2,±àºÅ·½Ê½
·½·¨Ò»£ºÊ¹ÓÃpid = id ÒÀ´ÎÕÒµ½¸Ã½ÚµãϵÄ×Ó½Úµã
·½·¨¶þ£ºÊ¹ÓñàºÅ£ºÈç000000±íʾµÚÒ»²ã£¬Æä×Ó½ÚµãΪ000100£¬000200£¬000300µÈ£¬¶ø000100µÄ×Ó½ÚµãΪ000101ºÍ000102µÈ£»ÕâÑù¿ÉÒÔ°´ÕÕÕâ¸ö±àºÅµÄ´óС°ÑÕû¸öÊý¾ÝÄóöÀ´£»
´æ´¢Æ÷µÄ¹Ø¼ü×Ö£ºprocedure : ¶¨ÒåÒ»¿éÓï¾ä¿é£»¸øÒ»¿éÓï¾ä¿éÆðÃû×Ö£»¿ÉÒÔʵÏֵݹ飻
Ö´ÐÐprocedureÓï¾ä£º1£¬exec ´æ´¢Æ÷Ãû£»2£¬begin ´æ´¢Æ÷Ãû; end;
´ø²ÎÊýµÄ´æ´¢Æ÷£º²ÎÊý£º in Ò²¾ÍÊÇĬÈÏģʽ,´«Èëģʽ £


Ïà¹ØÎĵµ£º

Oracle´æ´¢¹ý³Ì½Ì³Ì


Ò»¸ö¼òµ¥µÄoracle·ÖÒ³´æ´¢¹ý³ÌµÄʵÏֺ͵÷Óá£ÔÚ¿´ÁËÖÚ¶àµÄ·ÖÒ³´æ´¢¹ý³ÌÒÔºó·¢ÏÖ¶¼ÊÇÕë¶ÔsqlserverµÄ£¬¶øûÓÐoracleµÄ£¬Òò´ËÏëдһ¸ö¹ØÓÚoracleµÄ´æ´¢¹ý³Ì£¬ÒòΪÎÒÓõ½µÄÊý¾Ý¿âÊÇoracle¡£
Oracle·ÖÒ³´æ´¢¹ý³ÌµÄ˼·ÓÚsqlserverµÄ˼·ÊÇÒ»ÑùµÄ£¬µ«ÊÇÎÒÕâÀï×öÁ˵ã¸Ä¶¯£¬ÔÚÒòΪOracleµÄÓï·¨ºÍ¹æÔòµÄ²»Í¬ËùÒÔ£¬Oracle·ÖÒ³´æ´¢ ......

Oracle substr ºÍ instr µÄÓ÷¨

INSTR·½·¨µÄ¸ñʽΪ
INSTR(Ô´×Ö·û´®, Ä¿±ê×Ö·û´®, ÆðʼλÖÃ, Æ¥ÅäÐòºÅ)
ÀýÈ磺INSTR('CORPORATE FLOOR','OR', 3, 2)ÖУ¬Ô´×Ö·û´®Îª'CORPORATE FLOOR', Ä¿±ê×Ö·û´®Îª'OR'£¬ÆðʼλÖÃΪ3£¬È¡µÚ2¸öÆ¥ÅäÏîµÄλÖá£
ĬÈϲéÕÒ˳ÐòΪ´Ó×óµ½ÓÒ¡£µ±ÆðʼλÖÃΪ¸ºÊýµÄʱºò£¬´ÓÓұ߿ªÊ¼²éÕÒ¡£
ËùÒÔSELECT INSTR('CORPORATE FLOOR' ......

oracleÓû§È¨Ï޵IJéѯ

oracleÖв鿴Óû§È¨ÏÞ
1.²é¿´ËùÓÐÓû§£º
  select * from dba_users;
  select * from all_users;
  select * from user_users;
2.²é¿´Óû§»ò½ÇɫϵͳȨÏÞ(Ö±½Ó¸³Öµ¸øÓû§»ò½ÇÉ«µÄϵͳȨÏÞ)£º
  select * from dba_sys_privs;
  select * from user_sys_privs;
3.²é¿´½ÇÉ«(Ö»Äܲ鿴µÇ½Óà ......

oracle³£ÓÃÊÓͼ

 v$database Êý¾Ý¿âÐÅÏ¢
v$datafile Êý¾ÝÎļþÐÅÏ¢
v$controlfile ¿ØÖÆÎļþÐÅÏ¢
v$logfile ÖØ×öÈÕÖ¾ÐÅÏ¢
v$instance Êý¾Ý¿âʵÀýÐÅÏ¢
v$log ÈÕÖ¾×éÐÅÏ¢
v$loghist ÈÕÖ¾ÀúÊ·ÐÅÏ¢
v$sga Êý¾Ý¿âSGAÐÅÏ¢
v$parameter ³õʼ»¯²ÎÊýÐÅÏ¢
v$process Êý¾Ý¿â·þÎñÆ÷½ø³ÌÐÅÏ¢
v$bgprocess Êý¾Ý¿âºǫ́½ø³ÌÐÅÏ¢
v$controlfil ......

ORACLE NULLÏê½â

ÎÊ£ºÊ²Ã´ÊÇNULL£¿
´ð£ºÔÚÎÒÃDz»ÖªµÀ¾ßÌåÓÐʲôÊý¾ÝµÄʱºò£¬Ò²¼´Î´Öª£¬¿ÉÒÔÓÃNULL£¬ÎÒÃdzÆËüΪ¿Õ£¬ORACLEÖУ¬º¬ÓпÕÖµµÄ±íÁ㤶ÈΪÁã¡£
 
ORACLEÔÊÐíÈκÎÒ»ÖÖÊý¾ÝÀàÐ͵Ä×Ö¶ÎΪ¿Õ£¬³ýÁËÒÔÏÂÁ½ÖÖÇé¿ö£º
1¡¢Ö÷¼ü×ֶΣ¨primary key£©£¬
2¡¢¶¨ÒåʱÒѾ­¼ÓÁËNOT NULLÏÞÖÆÌõ¼þµÄ×Ö¶Î
˵Ã÷£º
1¡¢µÈ¼ÛÓÚûÓÐÈκÎÖµ¡¢ÊÇδ֪ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ