DO $$
BEGIN
CREATE TABLE SECRETARIA_PARADA (
       SECRETARIAPARADA_ID  INTEGER NOT NULL,
       SECRETARIA_ID        NUMBER(7) NULL,
       ORIGEN_ID            NUMBER(7) NULL,
       DESTINO_ID           NUMBER(7) NULL,
       ACTIVO               NUMBER(1) NULL,
       FECMODIF             DATE NULL,
       USUARIO_ID           NUMBER(7) NULL,
       PRIMARY KEY (SECRETARIAPARADA_ID), 
       FOREIGN KEY (SECRETARIA_ID) REFERENCES SECRETARIA, 
       FOREIGN KEY (DESTINO_ID) REFERENCES PARADA, 
       FOREIGN KEY (ORIGEN_ID) REFERENCES PARADA
	);

  CREATE SEQUENCE SECRETARIAPARADA_SEQ INCREMENT BY 1 START WITH 1 MAXVALUE 9999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER;

  EXCEPTION 
    WHEN duplicate_table THEN NULL;
    WHEN duplicate_object THEN NULL;
    WHEN duplicate_column THEN NULL;
END
$$;