Creer une sequence CREATE SEQUENCE
Code .NET SQL :: SQL :: SQL :: SQL Oracle
Page 1 sur 1
Creer une sequence CREATE SEQUENCE
- Code:
CREATE TABLE COST_ACTION_ORIGIN
(
ID_COST_ACTION_ORIGIN INTEGER,
CODE VARCHAR2(50),
VALID VARCHAR2(2),
CONSTRAINT COST_ACTION_ORIGIN_PK
PRIMARY KEY (ID_COST_ACTION_ORIGIN)
) ;
CREATE SEQUENCE SEQ_COST_ACTION_ORIGIN
START WITH 1
MAXVALUE 999999999999999999999999999
MINVALUE 1
NOCYCLE
NOCACHE
NOORDER;
CREATE OR REPLACE TRIGGER TRG_BI_COST_ACTION_ORIGIN BEFORE INSERT ON COST_ACTION_ORIGIN
FOR EACH ROW
DECLARE
NewId INTEGER;
BEGIN
SELECT SEQ_COST_ACTION_ORIGIN.NEXTVAL INTO NewId FROM DUAL;
:NEW.ID_COST_ACTION_ORIGIN := NewId ;
END;
Code .NET SQL :: SQL :: SQL :: SQL Oracle
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum