覿 企 襷り 朱覯 朱 曙螻 螳 蟆. 企
る狩伎 る朱 螳豌企ゼ 燕 譴狩. る 朱 讀螳 襯 燕
譯朱 螳豌伎. 覓碁 れ螻 螳給.
CREATE SEQUENCE SEQUENCE_NAME
INCREMENT BY 螳
START WITH 螳
MAXVALUE 螳 / NOMAXVALUE
MINVALUE 螳 / NOMINVALUE
CYCLE / NOCYCLE
CACHE 螳 / NOCACHE
ORDER / NOODER;
譯殊伎狩 旧 覈螳襯 危エ覲企 一 MAXVLAUE/NOMAXVALUE螳 旧 り 讀
螳 豕螳 . MAXVALUE 蠍磯蓋螳 1024. NOMAXVALUE襦 れ
覃 覓危襦 螳 手蟆 . CYCLE企 旧 れ 豕螳 覃 蠏 れ螳
朱 豕豐 螳 蟆. 蠍磯蓋螳 螳 . CACHE/NOCACHE朱 旧
貂襯 襦 讌 蟆. 願 讌讌 朱 蠍磯蓋朱 る狩伎 20螳
螳 貂.
煙 企慨蟆給..
SQL> CREATE sequence seq_iii
2 increament BY 1
3 start WITH 50
4 maxvalue 100
5 nocache
6 nocycle;
increament BY 1
*
2 る:
ORA-00933: SQL 覈轟願 覦襯願 譬襭讌 給
SQL> c /increament BY 1/increment BY 1
2* increment BY 1
SQL> run
1 CREATE sequence seq_iii
2 increment BY 1 -- 1襦 讀螳
3 start WITH 50 -- 50覿
4 maxvalue 100 -- 豕螳 100
5 nocache
6* nocycle
譯朱碁瑚 焔給.
SQL> SELECT seq_iii.NEXTVAL FROM dual;
NEXTVAL
----------
50
SQL> SELECT seq_iii.currval FROM dual;
CURRVAL
----------
50
SQL> CREATE TABLE seq_test (id number);
企 焔給.
SQL> CREATE TABLE seq_test (id number);
企 焔給.
SQL> INSERT INTO seq_test VALUES (seq_iii.NEXTVAL);
1 螳 襷れ伎給.
SQL> SELECT * FROM seq_test;
ID
----------
51
SQL> -- 企 煙 貉殊 蠍磯蓋螳 れ伎がる INSERT れ螻 螳 覃企
SQL> ALTER TABLE STUDENT
2 ADD APPLY DATE DEFAULT SYSDATE;
企 覲蟆暑給.
SQL> INSERT INTO STUDENT
2 VALUES ('9655023', '煙', '0164506701', DEFAULT);
1 螳 襷れ伎給.
SQL> -- APPLY 貉殊 蠍磯蓋螳朱 ろ 讌襯
SQL> SELECT * FROM STUDENT
2 WHERE S_NUM = '9655023';
S_NUM S_NAME S_PHONE APPLY
------- -------- ----------- --------
9655023 煙 0164506701 02/05/19
SQL> -- DEFAULT 朱 れ襦 蠍磯蓋螳 れ願 覈 譯殊 蠍磯蓋螳 れ願.
SQL> INSERT INTO STUDENT(S_NUM, S_NAME, S_PHONE)
2 VALUES ('9555037', '語', '0172204580');
1 螳 襷れ伎給.
SQL> SELECT * FROM STUDENT
2 WHERE S_NUM = '9555037';
S_NUM S_NAME S_PHONE APPLY
------- -------- ----------- --------
9555037 語 0172204580 02/05/19
れ 覲蟆曙 覈 焔碁螻 螳 start WITH覓語 る 蟆 訖. 讀, 企
轟 れ 螳 伎蠍 覓語. DROP sequence sequence_name
覃 .
伎 蠍磯蓋 INSERT 覓語 覯 給. 麹 螳譯? 伎 SELECT 覓瑚骸 豎讌
INSERT 覓語 れ牛企慨襦 蟆給. 襾殊 企 燕.
SQL> CREATE TABLE TEMP
2 (EMPNO NUMBER(4) PRIMARY KEY,
3 ENAME VARCHAR2(10),
4 JOB VARCHAR2(9),
5 MGR NUMBER(4),
6 HIREDATE DATE,
7 SAL NUMBER(7,2),
8 COMM NUMBER(7,2),
9 DEPTNO NUMBER(2));
企 焔給.
SQL> INSERT INTO TEMP
2 SELECT * FROM EMP
3 WHERE DEPTNO = 20;
5 螳 襷れ伎給.
SQL> SELECT * FROM TEMP;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- -------- ---------- ---------- ----------
7369 SMITH CLERK 7902 80/12/17 800 20
7566 JONES MANAGER 7839 81/04/02 2975 20
7788 SCOTT ANALYST 7566 87/04/19 3000 20
7876 ADAMS CLERK 7788 87/05/23 1100 20
7902 FORD ANALYST 7566 81/12/03 3000 20
SQL> -- 企 覦覯 讌~
SQL> CREATE TABLE TEMP2
2 AS
3 SELECT * FROM EMP
4 WHERE DEPTNO = 10;
企 焔給.
SQL> SELECT * FROM TEMP2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- -------- ---------- ---------- ----------
7782 CLARK MANAGER 7839 81/06/09 2450 10
7839 KING PRESIDENT 81/11/17 5000 10
7934 MILLER CLERK 7782 82/01/23 1300 10
1111 MILLER CLE%RK 7782 82/01/23 1300 10
企蟆 SELECT 覓語 伎伎 INSERT襯 給. 譬 覲旧″ 貎朱Μ覓語 曙
蟆讌.