CREATE TABLE MY_TBL_DETAILS
( "ID" NUMBER(10,0) NOT NULL ENABLE,
"PRODUCTTYPE" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"REFNO" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"TOTALDOCCOUNT" NUMBER(*,0) DEFAULT 0,
"ALLDOCUPLOADED" VARCHAR2(10 BYTE) DEFAULT 'false',
"KYCPAGEURL" VARCHAR2(500 BYTE) DEFAULT ''
);
CREATE SEQUENCE SEQ_MY_TBL_DETAILS
MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ;
CREATE OR REPLACE TRIGGER MY_TBL_DETAILS_SEQ
BEFORE INSERT ON MY_TBL_DETAILS
FOR EACH ROW
BEGIN
SELECT SEQ_MY_TBL_DETAILS.NEXTVAL
INTO :new.id
FROM dual;
END;
/
ALTER TRIGGER MY_TBL_DETAILS_SEQ ENABLE;
No comments:
Post a Comment