Oracle ÈçºÎ¶¨Òå×Ô¶¯ÔöÁ¿autocreamentµÄÖ÷¼üID?
MySQLµÄID·Ç³£·½±ã¶¨Ò壬ֻҪָ¶¨Æä×ֶεÄ×Ô¶¯ÔöÁ¿ÊôÐÔ¼´¿É¡£
µ«ÊÇOracle²»ÐУ¬ÐèÒª¶¨ÒåsequenceºÍtriggedr£¬µ±È»trigger¿ÉÒÔ²»¶¨Ò壬µ«ÊDz»·½±ã¡£
±í¶¨ÒåÈçÏ£º
CREATE TABLE GAME
(
ID
INTEGER NOT NULL,
GAME_DATE
DATE NOT NULL,
START_TIME DATE,
END_TIME DATE,
GAME_RULE_ID INTEGER
)
ÎÒÏë²åÈëʱ²»±ØÖ¸³öId
INSERT INTO game(game_date, start_time, Game_rule_id)
VALUES (to_date(‘2003/05/03′, ‘yyyy/mm/dd’), to_date(‘21:02:44′,
‘hh24:mi:ss’), 1) £»
Ê×Ïȶ¨Òåsequence
create sequence game_sequence
start with 1
increment
by 1;
È»ºó¶¨Òåtrigger
create TRIGGER game_trigger
BEFORE INSERT
ON game
REFERENCING
NEW AS NEW
FOR EACH ROW
BEGIN
SELECT
game_sequence.nextval INTO :NEW.ID from dual;
END;
²é¿´ÒѾ´æÔÚµÄsequenceºÍtrigger
SELECT sequence_name from user_sequences;
SELECT trigger_name from user_triggers;
ɾ³ýÒѾ¶¨ÒåµÄsequenceºÍtrigger
DROP sequence game_sequence;
DROP trigger game_trigger;
½ûÓúÍÆôÓÃtrigger
ALTER trigger game_trigger disable;
ALTER trigger game_trigger enable;
Ïà¹ØÎĵµ£º
1 - / , . ; :
"text" ʱ¼ä·Ö¸ô·ûºÅ£¬³ýÁ˱ê×¼µÄ¼¸¸ö£¬»¹ÔÊÐíÓÃÎÄ×Ö×÷Ϊ·Ö¸î·ûºÅ¡£
ÀýÈç to_char(sysdate,'YYYY"Äê"mm"ÔÂ"dd"ÈÕ"')=2008Äê04ÔÂ24ÈÕ
2 AD
A.D. ¼´À¶¡ÎÄAnno DominiµÄ¼òд£¬±íʾ¹«Ôª.»á¸ù¾ÝnlsµÄ²»Í¬×ª»»Îª¹«Ôª»òÕßadµÈ
ÎÞÌØÊâ×¢ÒâÊÂÏî
3 AM
A.M. ÉÏ ......
¹ØϵÐÍÊý¾Ý¿âÀíÂÛÖÐ×Ö¶ÎÖµ±ØÐëÊǵ¥Öµ£¬¶øoracleÖÐÔÊÐíÔÚÒ»¸ö×Ö¶ÎÖд洢һ¸ö±íµÄÄÚÈÝ¡£
È磺Ա¹¤±íÖеÄÍâ¼ü ²¿ÃűàºÅ£¬oracleÖÐÕâ¸ö×ֶοÉÒÔ´æ·Å²¿ÃŵļǼ¶ø²¢²»ÊÇÒ»¸öÍâ¼ü£¬ÕâÑù²éѯʱºòµÄЧÂÊ»áÌá¸ß¡£
¿É±äÊý×飺
´´½¨´øÓпɱäÊý×éµÄ±í
´´½¨¿É±äÊý×é»ùÀàÐÍ
create or replace type »ùÀàÐÍÃû as object(×Ö¶ÎÇåµ¥);
......
ORACLEÊý¾Ý¿â²åÈëÐÔÄܲâÊÔ
MKing
2010-3-8
²âÊÔ»·¾³»ù±¾ÐÅÏ¢£º
OS£ºWindows XP sp3
DB£ºOracle 9.2.0.1 δÆôÓù鵵
DBÖØ×öÈÕÖ¾Îļþ´óС£º100MB
Ó²ÅÌÐͺţºSAMSUNG HD161GJ£¨SATA-300,160G,7200rpm,8M cache£©
CPU£ºIntel Core2 E8400£¨3.0G£©
Äڴ棺2G
ͨ¹ýHD TuneµÃµ½µÄÓ²ÅÌ»ù±¾²âÊÔÐÅÏ ......
TNS-12518: TNS:listener could not hand off client connection
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
32-bit Windows Error: 2: No such file or directory
½â¾ö·½·¨£º
ÒòΪÎÒʹÓõÄÊÇÐéÄâ»ú£¬ËùÒÔÔÚIPÉÏĬÈϵÄ×Ô¶¯· ......