SYNTAX :
CREATE OR REPLACE SEQUENCE SEQUENCE_NAME
START WITH 1
INCREMENT BY 1
CACHE 100;
HOW TO USE SEQUENCE IN EXISTING TABLE
CREATE TABLE EMP (ID NUMBER, NAME VARCHAR2(15),SALARY NUMBER(4));
CREATE SEQUENCE EMP_ID
START WITH 101
INCREMENT BY 1
CACHE 100;
INSERT INTO EMP (ID,NAME, SALARY) VALUES(EMP_ID.NEXTVAL,'LEARNING',4000);
OR
INSERT INTO EMP(ID,NAME,SALARY) VALUES(EMP_ID.NEXTVAL,'&NAME',&SALARY);
0 comments:
Post a Comment