oracleÖÐʵÏÖ×ÔÔöÁÐ
1.´´½¨Ñ§Éú±í£º
CREATE TABLE student (
xh number primary key,
Name varchar2(10) not null);
2. ´´½¨ÐòÁУº
CREATE SEQUENCE student_seq
START WITH 1
INCREMENT BY 1
NOCACHE;
°´»Ø³µ¼ü£¬ÏµÍ³Ìáʾ“ÐòÁÐÒÑ´´½¨”¡£ÕâÑù¾Í´´½¨ÁËÒ»¸ö×ÔÔöµÄÐòÁУ¬´ËÐòÁдÓ1¿ªÊ¼£¬Ã¿´ÎÔö³¤1¡£
3. Ïòstudent±íÖвåÈëÊý¾Ý£¬ÊäÈë´úÂëÈçÏ£º
INSERT INTO student
VALUES
(student_seq.nextval,’zhangsan’);
Ïà¹ØÎĵµ£º
HA
ÊÇHigh Availability
µÄÊ××Öĸ×éºÏ£¬·Òë¹ýÀ´£¬¿ÉÒÔ½Ð×ö¸ß¿ÉÓ㬻ò¸ß¿ÉÓÃÐÔ£¬¸ß¿ÉÓ㨻·¾³£©¡£ÎÒ¾õµÃÓ¦¸Ã˵HAÊÇÒ»¸ö¹ÛÄî¶ø²»ÊÇÒ»Ïî»òһϵÁоßÌå¼¼Êõ£¬¾ÍÏóÍø¸ñÒ»Ñù¡£×÷¹ýϵͳ
·½°¸¾ÍÖªµÀÁË£¬ÆÀ¼ÛϵͳµÄÐÔÄܵ±ÖоÍÓÐÒ»Ïî¸ß¿ÉÓ᣹ãÒåµÄ¸ß¿ÉÓÃÉæ¼°µ½ÏµÍ³µÄ¸÷¸ö·½Ã棬¼òµ¥À´Ëµ£¬ÈÃϵͳ²»»áÖжÏ
ÔËÐУ¬¾ÍÊǸ߿ÉÓᣰüÀ¨È ......
Create [or replace] trigger [ģʽ.]´¥·¢Æ÷Ãû
Before| after |instead of insert|delete|(update of ÁÐÃû)
{insert|delete|(update of ÁÐÃû) }
On ±íÃû|ÊÓͼ|ģʽÃû|Êý¾Ý¿âÃû
[for each row]
When Ìõ¼þ
PL/SQL¿é
˵Ã÷£º
......
Ò»¡¢Êý¾Ý¿â
Êý¾Ý¿â¹ËÃû˼ÒåÊÇÊý¾ÝµÄ¼¯ºÏ£¬¶øOracleÔòÊǹÜÀíÕâЩÊý¾Ý¼¯ºÏµÄÈí¼þϵͳ£¬ËüÊÇÒ»¸ö¶ÔÏó¹ØÏµÐ͵ÄÊý¾Ý¿â¹ÜÀíϵͳ¡£
¶þ¡¢±í¿Õ¼ä
±í¿Õ¼äÊÇOracle¶ÔÎïÀíÊý¾Ý¿âÉÏÏà¹ØÊý¾ÝµÄÂß¼Ó³Éä¡£Ò»¸öÊý¾Ý¿âÔÚÂß¼Éϱ»»®·Ö³ÉÒ»µ½Èô¸É¸ö±í¿Õ¼ä£¬Ã¿¸ö±í¿Õ¼ä°üº¬ÁËÔÚÂß¼ÉÏÏà¹ØÁªµÄÒ»×é½á¹¹¡£Ã¿¸öÊý¾Ý¿âÖ ......
oracle startupʱ ±¨´íORA-00600: ÄÚ²¿´íÎó´úÂ룬²ÎÊý: [kcratr1_lostwrt], [], [], [], [], [], [], []
ÔÒò¿ÉÄÜÊÇ·Ç·¨¹Ø»ú»òµôµçÔì³É,ÒÔÏÂÊdzöÏÖµÄÎÊÌâ¼°½â¾ö·½·¨:
C:\Documents and Settings\Administrator>sqlplus
ÇëÊäÈëÓû§Ãû: /as sysdba
SQL> startup
ORA-01081: ÎÞ·¨Æô¶¯ÒÑÔÚÔËÐÐµÄ ORACLE ......
OracleÌṩµÄÐòºÅº¯Êý:
ÒÔemp±íΪÀý:
1: rownum ×î¼òµ¥µÄÐòºÅ µ«ÊÇÔÚorder by֮ǰ¾ÍÈ·¶¨Öµ.
select rownum,t.* from emp t order by ename
ÐÐÊý
ROWNUM
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
1
11
7876
ADAMS
CLERK
7788
1987-5-23
1100
¡¡
20
2
2
7499
ALLEN
SALESMAN
7698
......