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

oracleÐÔÄÜÌá¸ß ÅúÁ¿°ó¶¨

author:skatetime:2010-05-04
ÔÚÎÒÃǵÄϵͳÀ´ó¼ÒÔÚдpl/sqlʱ£¬´¦Àí¶àÌõ¼Ç¼ʱ£¬¼¸ºõ¶¼ÊÇͨ¹ýÓαêÀ´Íê³ÉµÄ£¬ÕâÑùÊǷdz£Ó°ÏìÐÔÄܵġ£ÎÒÃÇ¿ÉÒÔÓÃÅúÁ¿°ó¶¨¿ÉÒÔ´ó´óµÄ¸ÄÉÆ¡£
 
ÅúÁ¿°ó¶¨ÊÇoracle9iÔö¼ÓµÄÌØÐÔ£¬ÊÇÖ¸Ö´Ðе¥´Îsql²Ù×÷ÄÜ´«µÝËùÓм¯ºÏÔªËصÄÊý¾Ý¡£Í¨¹ý°ó¶¨°ó¶¨±äÁ¿¿ÉÒÔ¼«´óµÄÌá¸ßÊý¾Ý´¦ÀíËٶȣ¬Ìá¸ßÓ¦ÓóÌÐòµÄËٶȡ£Åú´¦Àí¿ÉÒÔÓÃÓëselect£¬update£¬delete£¬insertÓï¾äÉϽøÐÐÅúÁ¿Êý¾ÝµÄ´¦Àí¡£
 
ÔÚÎÒÃÇдpl/sqlµÄʱºò£¬oracle»áΪselectºÍdmlÓï¾ä·ÖÅäÉÏÏÂÎÄÇø£¨Õâ¸ö²½ÖèÊǷdz£ºÄ×ÊÔ´µÄ£¬oracle¶ÔÓÚ̫Ƶ·±µÄÇл»£¬¶¼»»ÓÃÆäËü·½Ê½´úÌ棬ÀýÈçspin£©£¬Óαê¾ÍÊÇÉÏÏÂÎÄÇøµÄÖ¸Õë¡£ËùÒÔÔÚÎÒÃÇÈÕ³£codingʱ£¬¾¡Á¿ÉÙÓÃcursor£¬ËäÈ»cursorʹÓúܼòµ¥£¬µ«Ò²´øÀ´ºÜ´óµÄÐÔÄÜÎÊÌ⣬ÎÒÃÇÏÖÔÚϵͳÀïµÄÓαê¾Í·Ç³£¶à¡£
ÅúÁ¿°ó¶¨ÊÇʹÓÃbulk collectºÍforallÓï¾äÀ´Íê³ÉµÄ¡£
 
bulk collect£ºÓÃÓëÈ¡µÃÅúÁ¿Êý¾Ý£¬Ö»ÄÜÓû§£¬select£¬fetchºÍdml·µ»Ø×Ö¾ä
forall£ºÊÊÓÃÓÚÅúÁ¿µÄdml
ÏÂÃæ¼òµ¥½éÉÜÏÂʹÓÃÅúÁ¿°ó¶¨ºÍ²»Ê¹ÓÃÅúÁ¿°ó¶¨µÄÐÔÄܶԱȵÄÑùÀý,Ò»¹²Á½¸öÀý×Ó£º
²âÊÔ±í£º
create table TESTA
(
  ID   NUMBER(6) primary key not null ,
  NAME VARCHAR2(10)
)
**********************************************************************************
Àý×Ó1£º
Forall£º
ʹÓÃÅúÁ¿°ó¶¨£º
SQL> declare
  2   type id_table_type is table of number(6) index by binary_integer;
  3   type name_table_type is table of varchar2(10) index by binary_integer;
  4 
  5   id_table id_table_type;
  6   name_table name_table_type;
  7   start_time  number(10);
  8   end_time number(10);
  9 
 10  begin
 11 
 12  for i in 1..5000  loop
 13     id_table(i):=i;
 14     name_table(i):='name'||to_char(i);
 15  end loop;
 16 
 17  start_time:=dbms_utility.get_time;
 18  for i in 1..id_table.count loop
 19   insert into testa values(id_table(i),id_table(i))  ;
 20  e


Ïà¹ØÎĵµ£º

OracleʵÀý¸ÅÄî½âÎö

OracleÊý¾Ý¿â·þÎñÆ÷ÓÉÁ½²¿·Ö×é³É£¬Ò»²¿·ÖÊÇORACLEÊý¾Ý¿â£¬Ò»²¿·ÖÊÇORACLEʵÀý¡£ORACLEÊý¾Ý¿â¾ÍÊÇ´æ´¢ÔÚ´ÅÅÌÉϵÄORACLEÊý¾ÝÎļþ¡¢ÈÕÖ¾ÎļþºÍ¿ØÖÆÎļþ¡£ÊµÀýÊÇÓÃÀ´¶ÔÊý¾Ý¿â½øÐвÙ×÷¡¢¹ÜÀíµÄ¡£ÊµÀýÓÉһϵÁнø³ÌºÍÄÚ´æ×é³É¡£
Æô¶¯Êý¾Ý¿âµÄʱºòÏÈÔÚÄÚ´æ·ÖÅäÒ»¿éºÜ´óµÄ´æ´¢¿Õ¼ä£¬È»ºóÆô¶¯ORACLEÊý¾Ý¿âÔËÐÐʱÐèÒªµÄһϵÁнø³Ì£¬¼´ ......

oracle´æ´¢¹ý³ÌʵÀý

ÈÏʶ´æ´¢¹ý³ÌºÍº¯Êý
´æ´¢¹ý³ÌºÍº¯ÊýÒ²ÊÇÒ»ÖÖPL/SQL¿é£¬ÊÇ´æÈëÊý¾Ý¿âµÄPL/SQL¿é¡£µ«´æ´¢¹ý³ÌºÍº¯Êý²»Í¬ÓÚÒѾ­½éÉܹýµÄPL/SQL³ÌÐò£¬ÎÒÃÇͨ³£°ÑPL/SQL³ÌÐò³ÆΪÎÞÃû¿é£¬¶ø´æ´¢¹ý³ÌºÍº¯ÊýÊÇÒÔÃüÃûµÄ·½Ê½´æ´¢ÓÚÊý¾Ý¿âÖеġ£ºÍPL/SQL³ÌÐòÏà±È£¬´æ´¢¹ý³ÌÓкܶàÓŵ㣬¾ßÌå¹éÄÉÈçÏ£º
* ´æ´¢¹ý³ÌºÍº¯ÊýÒÔÃüÃûµÄÊý¾Ý¿â¶ÔÏóÐÎʽ´æ´¢ ......

ORACLE Óë mysql µÄÇø±ð

1.ÔÚORACLEÖÐÓÃselect * from all_usersÏÔʾËùÓеÄÓû§£¬¶øÔÚMYSQLÖÐÏÔʾËùÓÐÊý¾Ý¿âµÄÃüÁîÊÇshow
databases¡£¶ÔÓÚÎÒµÄÀí½â£¬ORACLEÏîÄ¿À´ËµÒ»¸öÏîÄ¿¾ÍÓ¦¸ÃÓÐÒ»¸öÓû§ºÍÆä¶ÔÓ¦µÄ±í¿Õ¼ä£¬¶øMYSQLÏîÄ¿ÖÐÒ²Ó¦¸ÃÓиöÓû§ºÍÒ»¸ö¿â¡£ÔÚ
ORACLE(db2Ò²Ò»Ñù)Öбí¿Õ¼äÊÇÎļþϵͳÖеÄÎïÀíÈÝÆ÷µÄÂß¼­±íʾ£¬ÊÓͼ¡¢´¥·¢Æ÷ºÍ´æ´¢¹ý³ÌÒ²¿É ......

oracle²»Í¬schemaÖ®¼ä½¨Íâ¼ü

ÐèҪȨÏÞ:
  grant references on test_sys to user_1;
 or
  grant all on test_sys to user_1;
²âÊÔ£º
sysÓû§ÏÂ:
SQL> create user user_1 identified by user_1;
Óû§ÒÑ´´½¨¡£
SQL> grant dba to user_1;
ÊÚȨ³É¹¦¡£
SQL> create table test_sys(pk_col varchar2(5))
  2&nbs ......

ORACLEÊý¾Ý×Öµä

²é¿´µ±Ç°Óû§µÄȱʡ±í¿Õ¼ä
 SQL>select username,default_tablespace from user_users;
        ²é¿´µ±Ç°Óû§µÄ½ÇÉ«
        SQL>select * from user_role_privs;
        ²é¿´µ±Ç°Óû§µÄÏµÍ³È ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ