惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

博客园 - liuqun

oracle优化7(如何干预执行计划 - hints) oracle优化6(使用sql_trace/10046事件进行数据库诊断) oracle优化5(用索引提高效率) oracle优化4(sql语句性能诊断,sql执行计划) oracle优化3(访问Table的方式) oracle优化2(选用适合的ORACLE优化器) oracle优化1(数据库、数据表、数据表I/O优化原则) Oracle常用命令14(.net / java代码调用(sql代码、程序包过程)) Oracle常用命令13(数据库的启动、关闭) Oracle常用命令12(导入:imp、导出:exp) Oracle常用命令10(程序包) Oracle常用命令9(函数) Oracle常用命令8(过程) Oracle常用命令7(游标) Oracle常用命令6(PL/SQL) Oracle常用命令5(同义词、视图、索引) Oracle常用命令4(表分区) Oracle常用命令3(DDL、DML、TCL、DCL、序列) Oracle常用命令2(用户、角色管理)
Oracle常用命令11(触发器)
liuqun · 2011-03-29 · via 博客园 - liuqun

触发器

CREATE [OR REPLACE] TRIGGER trigger_name

AFTER | BEFORE | INSTEAD OF

[INSERT] [[OR] UPDATE [OF column_list]]

[[OR] DELETE]

ON table_or_view_name

[REFERENCING {OLD [AS] old / NEW [AS] new}]

[FOR EACH ROW]

[WHEN (condition)]

pl/sql_block;

启用和禁用触发器

ALTER TRIGGER 触发器名 DISABLE/ENABLE;

删除触发器

DROP TRIGGER 触发器名;

显示有关触发器的信息

select trigger_name from dba_triggers/user_triggers;

显示某个表中的触发器的信息

select trigger_name from dba_triggers/user_triggers where table_name = '表名';

1:当订单明细商品数量、价格改变时,订单中的金额随之改变

create or replace trigger tri_product

after update of D_QUANTITY,D_PRICE on orderdetail

for each row

declare

       updateSum number;

begin    

       --得到订单明细的商品数量改变后的订单总金额,将订单表中的金额进行修改

       updateSum := :new.D_QUANTITY * :new.D_PRICE - :old.D_QUANTITY * :old.D_PRICE;

       dbms_output.put_line(:old.o_id);

       update orderTab set O_MONEY = O_MONEY + updateSum where O_ID = :old.O_ID;

end;

--测试触发器:订单明细商品数量、价格改变时,订单中的金额随之改变

update orderdetail set d_quantity = 3 where d_id=2;