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

Oracle´´½¨´¥·¢Æ÷

½ñÌìÔÚ°Ù¶ÈÉÏËÑË÷ÁËÏÂoracleдµÄ´¥·¢Æ÷£¬¸Ð¾õ»¹¿ÉÒÔ¡£
¾ÍÊղؿ©¡£
Óû§±í£º´´½¨´¥·¢Æ÷֮ǰÊ×ÏÈÒª´´½¨ÐòÁÐ
Óû§±íÐòÁУº
create sequence users_seq;
Óû§±í´¥·¢Æ÷£º
create or replace trigger bifer_users_userid_pk
before insert
on users
for each row
begin
select users_seq.nextval into:new.userid from dual;
end;
/
ÉÌÆ·±í£º
ÉÌÆ·±íÐòÁУºcreate sequence product_seq;
ÉÌÆ·±í´¥·¢Æ÷£º
create or replace trigger bifer_product_itemid_pk
before insert
on product
for each row
begin
select product_seq.nextval into:new.itemid from dual;
end;
/
ÉÌÆ·Æ·ÅÆ±í£º
ÉÌÆ·Æ·ÅƱíÐòÁУºcreate sequence brand_seq;
ÉÌÆ·Æ·ÅÆ±í´¥·¢Æ÷£º
create or replace trigger bifer_brand_brandid_pk
before insert
on brand
for each row
begin
select brand_seq.nextval into:new.brandid from dual;
end;
/
ÉÌÆ·Àà±ð±í£º
ÉÌÆ·±íÐòÁУºcreate sequence class_seq;
ÉÌÆ·±í´¥·¢Æ÷£º
create or replace trigger bifer_class_classid_pk
before insert
on class
for each row
begin
select class_seq.nextval into:new.classid from dual;
end;
/
Ò»¸ö´¥·¢Æ÷Ö»ÄÜÓÃÓÚÒ»¸ö±í£¬¶øÒ»¸ö±í¿ÉÒÔÓÐ×î¶àÈý¸ö´¥·¢Æ÷£¬ÉÌÆ·Æ·ÅÆÀà±ð±íÊǸ´ºÏÖ÷¼üËùÒÔ¾ÍΪÉÌÆ·±í½¨ÁËÁ½¸ö´¥·¢Æ÷·Ö±´×÷ÓÃÓÚÿ¸öÖ÷¼ü
ÉÌÆ·Æ·ÅÆÀà±ð±í£º
ÉÌÆ·Æ·ÅÆÀà±ðÐòÁУºcreate sequence brand_class_seq;
ÉÌÆ·Æ·ÅÆÀà±ð´¥·¢Æ÷(brandid)£º
create or replace trigger brand_class_brandid_pk
before insert
on brand_class
for each row
begin
select brand_class_seq.nextval into:new.brandid from dual;
end;
/
ÉÌÆ·Æ·ÅÆÀà±ð´¥·¢Æ÷(classid)£º
create or replace trigger brand_class_classid_pk
before insert
on brand_class
for each row
begin
select brand_class_seq.nextval into:new.classid from dual;
end;
/
ÔÚoracleÖУ¬ÎªÁË·½±ã³£³£Óô¥·¢Æ÷¼°ÐòÁнáºÏÆðÀ´ÊµÏÖ     
ÏȽ¨±í¡¢ÔÙ½¨ÐòÁС¢È»ºóÊÇ´¥·¢Æ÷£¬×îºó²âÊÔ
=============================================                
                   &


Ïà¹ØÎĵµ£º

oracle¸´Ï°£¨Ò»£© Ö®OracleÌåϵ½á¹¹

      ѧϰOracle DBAÒ²°ë¸ö¶àѧÆÚÁË£¬½ñÌìÃÍÈ»²Å·¢ÏÖ£¬Ô­À´ÎÒµÄÊ黹ÊǺÜеģ¬ÉϿβÙ×÷ʱºòÒ²Ö»ÊÇÖªµÀ´ó¸ÅÔõô×ö£¬µ«ÊÇÒªÕæµÄÈ«²¿×Ô¼º×ö£¬¶ø²»È¥·­Ê黹ÊÇÓÐÒ»¶¨µÄÄѶȵģ¬ËùÒÔÄØ£¬½ñÌ쿪ʼ½«DBA´ÓÍ·¸´Ï°Ò»±é£¬Í¬Ê±ÔÙ²Ù×÷Ò»±é¡£
      µÚÒ»Õ£¬Ñ§µÄÊÇOracleµÄÌåϵ½á¹¹£ ......

oracle²»¿É¸üеÄÊÔͼ

¹Ø¼ü´Ê£ºwith read only
×÷ÓãºÓÃÓÚÖ¸¶¨Ëù´´½¨µÄÊÔͼ²»¿ÉÒÔͨ¹ý±¾ÊÓͼ¸üбí
Ö´ÐÐÒ»ÏÂSQL£¬´´½¨±íT£¬ºÍÁ½¸öÊÔͼV1£¬V2£º
CREATE TABLE T(ID INTEGER);
CREATE VIEW V1 AS SELECT * from T;
CREATE VIEW V2 AS SELECT * from T WITH READ ONLY;
Ö´ÐÐSQL:
INSERT INTO V1 VALUES(1);
--------------------
1 row cre ......

Oracle LongÐÍ

Oracle LongÐÍ
 
1¡¢LONG Êý¾ÝÀàÐÍÖд洢µÄÊǿɱ䳤×Ö·û´®£¬×î´ó³¤¶ÈÏÞÖÆÊÇ2GB¡£
2¡¢¶ÔÓÚ³¬³öÒ»¶¨³¤¶ÈµÄÎı¾£¬»ù±¾Ö»ÄÜÓÃLONGÀàÐÍÀ´´æ´¢£¬Êý¾Ý×ÖµäÖкܶà¶ÔÏóµÄ¶¨Òå¾ÍÊÇÓÃLONGÀ´´æ´¢µÄ¡£
3¡¢LONGÀàÐÍÖ÷ÒªÓÃÓÚ²»ÐèÒª×÷×Ö·û´®ËÑË÷µÄ³¤´®Êý¾Ý£¬Èç¹ûÒª½øÐÐ×Ö·ûËÑË÷¾ÍÒªÓÃvarchar2ÀàÐÍ¡£
4¡¢ºÜ¶à¹¤¾ß£¬°üÀ¨SQL*Plus£¬´ ......

oracle ¼ì²é±»ËøµÄ±í¼°½âËø

´¦Àí·½·¨Ò» £º
¼ì²éÄǸö±í±»Ëø
select sess.sid,sess.serial#, lo.oracle_username,lo.os_user_name,ao.object_name,lo.locked_mode
from v$locked_object lo,dba_objects ao,v$session sess
where ao.object_id = lo.object_id
and lo.session_id = sess.sid;
½âËø
alter system kill session '273,45';
´¦Àí·½·¨¶ ......

Oracle´æ´¢¹ý³Ì×ܽá(Ò»¡¢»ù±¾Ó¦ÓÃ)

1¡¢´´½¨´æ´¢¹ý³Ì
create or replace procedure test(var_name_1 in type,var_name_2 out type) as
--ÉùÃ÷±äÁ¿(±äÁ¿Ãû ±äÁ¿ÀàÐÍ)
begin
--´æ´¢¹ý³ÌµÄÖ´ÐÐÌå
end test;
´òÓ¡³öÊäÈëµÄʱ¼äÐÅÏ¢
E.g:
create or replace procedure test(workDate in Date) is
begin
dbms_output.putline('The input date is: ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ