CREATE table "S" (
"A" NUMBER(5,5) NOT NULL,
"C" VARCHAR2(4000),
constraint "S_PK" primary key ("A")
)
/
CREATE sequence "S_SEQ"
/
CREATE trigger "BI_S"
before insert on "S"
for each row
begin
select "S_SEQ".nextval into :NEW.A from dual;
end;
/
ALTER TABLE "S" ADD CONSTRAINT "S_FK"
FOREIGN KEY ("C")
REFERENCES "TABLA1" ("ID")
/