Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/02/2007, 12:08
rickymax
 
Fecha de Ingreso: febrero-2007
Ubicación: Ecuador
Mensajes: 23
Antigüedad: 17 años, 2 meses
Puntos: 0
Trigger En Oracle

hola amigos soy nuevo en esta web me parece super insteresante espero que me ayuden, el nombre de mi post es igual a uno que encontre en esta misma web pero el problema es un poquito mejor :

sucede que estoy haciendo una pequeña bdd en oracle (por lo general uso sqlserber y mysql pero ya me toco oracle ni modo ) tiene 3 tablas

SQL> create table Estudiante(
2 Cod Integer,
3 Nombre VaINSEENrchar(10)
4 );

Table created.

SQL> ALTER TABLE Wily.Estudiante ADD(
2 Primary key
3 (Cod));

Table altered.

SQL> create table Materias(
2 CodM Integer,
3 NombreM Varchar(10));

Table created.

SQL> alter table wily.Materias add(
2 primary key
3 (CodM));

Table altered.

create table Nota(
2 codE integer,
3 codM integer,
4 Nota1 float DEFAULT 0,
5 Nota2 float DEFAULT 0,
6 Nota3 float DEFAULT 0,
7 Promedio float DEFAULT 0,
8 Mensaje Varchar(10) Default 'Reprobado');

Table created.

SQL> alter table Wily.Nota add(
2 CONSTRAINT FK_REFER
3 FOREIGN KEY (codE)
4 REFERENCES Wily.Estudiante (cod));

Table altered.


este es mi trigger

CREATE OR REPLACE TRIGGER calc_Aprobado

before INSERT OR UPDATE ON wily.Nota
FOR EACH ROW
DECLARE
v_ins_sum_notas float;

BEGIN
IF INSERTING THEN
IF :new.nota1 <> 0 and :new.nota2 <> 0 :new.nota3 <> 0 THEN
v_ins_sum_notas := (:new. nota1 + :new. nota2 + :new. Nota3);

IF v_ins_sum_notas >= 21 THEN
:new.Promedio:= v_ins_sum_notas /3;
:new.MENSAJE := 'APROBADO';
ELSIF (v_ins_sum_notas < 21)

:new.Promedio:= v_ins_sum_notas /3;
:new.MENSAJE := ' NO APROBADO';
END IF;
END IF;
END IF;
end;


diagnme cual es el problema