
  CREATE TABLE "STDT_SUBJECTS" 
   (	"SUBJECT_ID" NUMBER(15,0) NOT NULL ENABLE, 
	"SUBJECT_NAME" VARCHAR2(150) NOT NULL ENABLE, 
	"PRIMARY_FLAG" VARCHAR2(1) NOT NULL ENABLE, 
	"ENABLED_FLAG" VARCHAR2(1) NOT NULL ENABLE, 
	"CREATED_BY" VARCHAR2(150) NOT NULL ENABLE, 
	"CREATION_DATE" TIMESTAMP (6) NOT NULL ENABLE, 
	"LAST_UPDATED_BY" VARCHAR2(150) NOT NULL ENABLE, 
	"LAST_UPDATE_DATE" TIMESTAMP (6) NOT NULL ENABLE, 
	"TENANT_ID" NUMBER, 
	"CALENDAR_COLOR" VARCHAR2(150), 
	"DELETED_FLAG" VARCHAR2(1), 
	 CONSTRAINT "STDT_SUBJECTS_PK" PRIMARY KEY ("SUBJECT_ID")
  USING INDEX  ENABLE
   ) ;

  CREATE OR REPLACE EDITIONABLE TRIGGER "BI_STDT_SUBJECTS" 
  before insert on "STDT_SUBJECTS"               
  for each row  
begin   
  if :NEW."SUBJECT_ID" is null then 
    select "STDT_SUBJECTS_SEQ".nextval into :NEW."SUBJECT_ID" from sys.dual; 
  end if; 
end; 

/
ALTER TRIGGER "BI_STDT_SUBJECTS" ENABLE;