首页 > 数据库技术 > 详细

简单入门的Oracle触发器使用

时间:2014-07-29 11:55:16      阅读:341      评论:0      收藏:0      [点我收藏+]
--建表语句
create table student(id number(9),name varchar2(64),age number(5));create table class(id number(9),name varchar2(64),teacherid number(9),studentid number(9));create table teacher(id number(9),name varchar2(64),age number(5)); --学生信息 insert into student values(1,yangml,23); insert into student values(2,zhangj,23); insert into student values(3,zhulj,26); insert into student values(4,chenglp,26); --老师信息 insert into teacher values(1,yangls,33); insert into teacher values(2,zhangls,33); insert into teacher values(3,zhuls,33); insert into teacher values(4,chenls,33); --班级信息 insert into class values(1,一年级,1,1); insert into class values(2,二年级,2,2); insert into class values(3,三年级,3,3); insert into class values(4,四年级,4,4); --删除触发器 create or replace trigger trigdel before delete on class for each row declare -- local variables here begin delete from teacher where teacher.id=:old.id; delete from student where student.id=:old.id; end trigdel; --测试删除 delete from class; select * from class; select * from student; select * from teacher;

 

简单入门的Oracle触发器使用,布布扣,bubuko.com

简单入门的Oracle触发器使用

原文:http://www.cnblogs.com/yangml/p/3874312.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!