Основы работы с базами данных

Смотрите здесь опрыскиватели оптом. |

Сгенерированная Case Studio SQL-программа создания таблиц базы данных для сервера Oracle - часть 2


Cannot update child.'); end; end if; end; end if; -- restrict parent FCLT when child Student updated if :new_upd."n_fclt" != :old_upd."n_fclt" then begin select count( * ) into numrows from "FCLT" where :new_upd."n_fclt" = "FCLT"."n_fclt"; if ( numrows = 0 ) then begin RAISE_APPLICATION_ERROR(-20002,'Parent does not exist. Cannot update child.'); end; end if; end; end if;

end; / -- Update trigger for Ocenki Create Trigger "tu_Ocenki" after update of "n_predm","Nz" on "Ocenki" referencing new as new_upd old as old_upd for each row declare numrows integer; begin -- restrict parent Predmet when child Ocenki updated if :new_upd."n_predm" != :old_upd."n_predm" then begin select count( * ) into numrows from "Predmet" where :new_upd."n_predm" = "Predmet"."n_predm"; if ( numrows = 0 ) then begin RAISE_APPLICATION_ERROR(-20002,'Parent does not exist. Cannot update child.'); end; end if; end; end if; -- restrict parent Student when child Ocenki updated if :new_upd."Nz" != :old_upd."Nz" then begin select count( * ) into numrows from "Student" where :new_upd."Nz" = "Student"."Nz"; if ( numrows = 0 ) then begin RAISE_APPLICATION_ERROR(-20002,'Parent does not exist. Cannot update child.'); end; end if; end; end if;

end; / -- Update trigger for Predmet Create Trigger "tu_Predmet" after update of "n_predm" on "Predmet" referencing new as new_upd old as old_upd for each row declare numrows integer; begin -- cascade child Ocenki update when parent Predmet changed if (:old_upd."n_predm" != :new_upd."n_predm") then begin update "Ocenki" set "n_predm" = :new_upd."n_predm" where "Ocenki"."n_predm" = :old_upd."n_predm" ; end; end if; end; / -- Update trigger for FCLT Create Trigger "tu_FCLT" after update of "n_fclt" on "FCLT" referencing new as new_upd old as old_upd for each row declare numrows integer; begin -- cascade child Student update when parent FCLT changed if (:old_upd."n_fclt" != :new_upd."n_fclt") then begin update "Student" set "n_fclt" = :new_upd."n_fclt" where "Student"."n_fclt" = :old_upd."n_fclt" ; end; end if; end; / -- Update trigger for SPECT Create Trigger "tu_SPECT" after update of "n_spect" on "SPECT" referencing new as new_upd old as old_upd for each row declare numrows integer; begin -- cascade child Student update when parent SPECT changed if (:old_upd."n_spect" != :new_upd."n_spect") then begin update "Student" set "n_spect" = :new_upd."n_spect" where "Student"."n_spect" = :old_upd."n_spect" ; end; end if; end; / -- Insert trigger for Student Create Trigger "ti_Student" after insert on "Student" referencing new as new_ins for each row declare numrows integer; begin -- restrict child Student when parent SPECT insert if (:new_ins."n_spect" is not null) then begin select count( * ) into numrows from "SPECT" where :new_ins."n_spect" = "SPECT"."n_spect"; IF ( numrows = 0 ) then begin RAISE_APPLICATION_ERROR(-20004,'Parent does not exist.


Начало  Назад  Вперед



Книжный магазин