梁赛的博客

我的目标: 程序员里seo技术最好的,seo界里程序写的最好的!

« PR8的三个中文站(google PR最近变化很大啊)修改后的Oracle触发器 »

Oracle触发器很好使

工作中遇到一个表需要另一个表的数据,而做视图的话会影响一堆程序..于是加了个字段再写了个触发器.这是第一次写触发器.感觉挺不错.这东西很方便,以下是实例:


create or replace trigger T_YJZT
  after update on bz_txb
 
declare
  -- local variables here
begin

update bz_gzdg set yjzt=(select yjzt from bz_txb where bz_txb.xh=bz_gzdg.xmbh);  
update bz_jysxx set yjzt=(select yjzt from bz_txb where bz_txb.xh=bz_jysxx.xmbh);  
update bz_ssgxx set yjzt=(select yjzt from bz_txb where bz_txb.xh=bz_ssgxx.xmbh);  
update bz_bpgxx set yjzt=(select yjzt from bz_txb where bz_txb.xh=bz_bpgxx.xmbh);  
update bz_ZQYJ set yjzt=(select yjzt from bz_txb where bz_txb.xh=bz_ZQYJ.xmbh);  
end T_YJZT;
 

 

创建触发器和删除触发器和创建表删除表看来差不多..

 Oracle的确是很优秀的数据库..呵呵

 

 

  • 相关文章:

发表评论:

◎ 看完了就走的人不厚道 。

日历

最新评论及回复

最近发表

Powered By liangsai.com

Copyright www.LiangSai.com All Rights Reserved. 冀ICP备07016626号 sitemap