Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2010, 10:57
qsflay
 
Fecha de Ingreso: febrero-2009
Mensajes: 36
Antigüedad: 15 años, 9 meses
Puntos: 0
problemas con script de creacion de tablas

hola, tengo el siguiente script:
Código:
CREATE TABLE  "ASIGNATURAS" 
   (	"CODIASIG" NUMBER NOT NULL ENABLE, 
	"NOM" VARCHAR2(4000) NOT NULL ENABLE, 
	 CONSTRAINT "ASIGNATURAS_PK" PRIMARY KEY ("CODIASIG") ENABLE
   )
/

CREATE OR REPLACE TRIGGER  "BI_ASIGNATURAS" 
  before insert on "ASIGNATURAS"               
  for each row  
begin   
select seq_assig.nextval into :NEW.CODIASIG from dual;
end; 
/
ALTER TRIGGER  "BI_ASIGNATURAS" ENABLE
/

CREATE OR REPLACE TRIGGER  "T_ASSIG" 
after delete on asignaturas
for each row
begin
delete from horari where codasig = :OLD.CODIASIG;
end;
/

ALTER TRIGGER  "T_ASSIG" ENABLE
/

CREATE OR REPLACE TRIGGER  "T_ELMASSIG" 
after delete on ASIGNATURAS
for each row
begin
delete from horari where codasig=:old.codiasig;
end;
/

ALTER TRIGGER  "T_ELMASSIG" ENABLE
/

CREATE TABLE  "AULA" 
   (	"IDAULA" NUMBER(3,0), 
	"NOMAULA" VARCHAR2(50), 
	"DESCRIP" VARCHAR2(150), 
	 CONSTRAINT "AULAPK" PRIMARY KEY ("IDAULA") ENABLE
   )
/

CREATE OR REPLACE TRIGGER  "T_ELAULA" 
after delete on aula
for each row
begin
delete from horari where idaula = :old.idaula;
end;
/

ALTER TRIGGER  "T_ELAULA" ENABLE
/

CREATE TABLE  "DEPARTAMENT" 
   (	"IDDEPT" NUMBER(4,0), 
	"NOMDEPT" VARCHAR2(100) NOT NULL ENABLE, 
	 CONSTRAINT "DEPTPK" PRIMARY KEY ("IDDEPT") ENABLE
   )
/

CREATE OR REPLACE TRIGGER  "T_ELMDEPT" 
after delete on departament
for each row
begin
update professor set iddept = null where iddept = :old.iddept;
end;
/

ALTER TRIGGER  "T_ELMDEPT" ENABLE
/

CREATE TABLE  "FALTAPROFE" 
   (	"IDPROFE" NUMBER(4,0), 
	"DATA" DATE, 
	"HORA" VARCHAR2(5), 
	"MOTIU" VARCHAR2(100), 
	"FEINA" VARCHAR2(500), 
	 CONSTRAINT "AUSENCIAPK" PRIMARY KEY ("IDPROFE", "DATA") ENABLE
   )
/

CREATE TABLE  "FALTES_PER_PROFES" 
   (	"ID_PROFE" NUMBER NOT NULL ENABLE, 
	"CONTAGUARD" NUMBER NOT NULL ENABLE, 
	 CONSTRAINT "FALTES_PER_PROFES_PK" PRIMARY KEY ("ID_PROFE") ENABLE
   )
/

CREATE TABLE  "GUARDIA" 
   (	"IDGUARDIA" NUMBER(10,0), 
	"IDPROFE" NUMBER(4,0), 
	"DIA" VARCHAR2(10) NOT NULL ENABLE, 
	"HORA" VARCHAR2(5), 
	 PRIMARY KEY ("IDGUARDIA") ENABLE, 
	 CONSTRAINT "GUARDIAFKPROF" FOREIGN KEY ("IDPROFE")
	  REFERENCES  "PROFESSOR" ("IDPROFE") ENABLE
   )
/

CREATE TABLE  "GUARDIAEFECTIVA" 
   (	"IDGUARDIA" NUMBER(10,0), 
	"DATA" DATE, 
	"PROFEACOBRIR" NUMBER(4,0), 
	"SIGNADA" VARCHAR2(1), 
	"TASQUES" VARCHAR2(100), 
	 CONSTRAINT "GEPK" PRIMARY KEY ("IDGUARDIA", "DATA") ENABLE, 
	 CONSTRAINT "GEFK1" FOREIGN KEY ("IDGUARDIA")
	  REFERENCES  "GUARDIA" ("IDGUARDIA") ENABLE, 
	 CONSTRAINT "GEFK3" FOREIGN KEY ("PROFEACOBRIR")
	  REFERENCES  "PROFESSOR" ("IDPROFE") ENABLE
   )
/

CREATE TABLE  "HORARI" 
   (	"CODASIG" NUMBER(5,0), 
	"DIA" VARCHAR2(10), 
	"HORA" VARCHAR2(5), 
	"IDPROFE" NUMBER(4,0), 
	"IDAULA" NUMBER(3,0), 
	 CONSTRAINT "HORARIPK" PRIMARY KEY ("CODASIG", "DIA", "HORA") ENABLE, 
	 CONSTRAINT "HORARIPKPROF" FOREIGN KEY ("IDPROFE")
	  REFERENCES  "PROFESSOR" ("IDPROFE") ENABLE, 
	 CONSTRAINT "HORARIPKAULA" FOREIGN KEY ("IDAULA")
	  REFERENCES  "AULA" ("IDAULA") ENABLE
   )
/


CREATE TABLE  "PROFESSOR" 
   (	"IDPROFE" NUMBER(4,0), 
	"NOM" VARCHAR2(50), 
	"COGNOMS" VARCHAR2(50), 
	"SIGNATURA" VARCHAR2(10), 
	"IDDEPT" NUMBER(3,0), 
	 CONSTRAINT "PROFESSORPK" PRIMARY KEY ("IDPROFE") ENABLE, 
	 FOREIGN KEY ("IDDEPT")
	  REFERENCES  "DEPARTAMENT" ("IDDEPT") ENABLE
   )
/

CREATE OR REPLACE TRIGGER  "T_PROFE" 
after delete on PROFESSOR
for each row
begin
delete from horari where idprofe=:old.idprofe;
delete from guardia where idprofe=:old.idprofe;
end;
/

ALTER TRIGGER  "T_PROFE" ENABLE
/
Al cargarlo y ejecutarlo, me da error al crear las tablas "guardia", "guardiaefectiva" y "horaris" diciendo: ORA-00942: la tabla o vista no existe

Si se ejecutan las sentencias que las crea por separado, no da error y si las crea,
Alguien me puede decir el porque pasa?

Gràcias