77范文网 - 专业文章范例文档资料分享平台

Oracle9i笔记2(4)

来源:网络收集 时间:2019-03-22 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

LOGON and LOGOFF Trigger example

1. CREATE OR REPLACE TRIGGER logon_trig AFTER LOGON ON SCHEMA BEGIN

INSERT INTO log_trig_table(user_id,log_date,action) VALUES(USER,SYSDATE,’logging on ’); End;

2. CREATE OR REPLACE TRIGGER logoff_trig

BEFORE LOGOFF ON SCHEMA

BEGIN

INSERT INTO log_trig_table(user_id,log_date,action) VALUES (USER,SYSDATE,’Logging off’); End;

Call statement

Trigger 中的body部分可以調用內部或外部過程。 Implementating triggers You can use trigger for: ? Security ? Auditing

? Data integrity ? Referential integrity ? Table replication

? Computing derived data automativally ?

Event logging

CREATE SNAPSHOT emp_copy AS SELECT * FROM emp@ny;

導出數據:

Computing drived data within the server

Update

dept

set

total_sal=(select

sum(salary)

from

emp.deportno=dept.dept_no)

Benefits of database triggers

? Improved data security:

? Provide enhanced and complex security checks ? Provide enhanced and complex auditing ? Improved data integrity:

? Enforce dynamic data integrity constraints

? Enforce complex referential integrity constraints

? Ensure that related operations are performed together implicitly.

emp

where

Summary

In this lesson, you should have learned how to: ? Use advanced database triggers(還沒用過) ? List mutating and constraining rules for triggers

列出表的突然變化和限制規則對觸發器的影響(還不是很清楚) ? Describe the real-world application of triggers(還不清楚) ? Manage triggers ? View trigger information

Chapter 18 managing dependencies

After completing this lesson, you should be able to do the following: ? Track procedural dependencies. 了解過程的關系

? Predict the effect of changing a database object upon stored procedures and functions

預見過程或函數改變后產生的后果。 ? * manage procedural dependencies 管理過程的關系。

This lesson introduces you to object dependencies and implicit and explicit recompilation of invalid objects.

Recompiling a PL/SQL Program Unit 重新編譯過程,函數,包及觸發器。

ALTER PROCEDURE [SCHEMA.] procedure_name COMPILE; ALTER FUNCTION [SCHEMA.] function_name COMPILE

ALTER PACKAGE [SCHEMA.] package_name COMPILE[PACKAGE]; ALTER PACKAGE[SCHEMA.] package_name COMPILE BODY; ALTER TRIGGER trigger_name [COMPILE[DEBUG]];

? Using DEPTEREE_FILL and IDEPTREE to view dependencies ? Recompiling procedures, functions, and packages

APPENDIX

REF Cursors

? Cursor variables are like C or Pascal pointers, which hold the memory location(address) of an

item instead of the item itself

? In PL/SQL, a pointer is declared as REF X, where REF is short for REFERENCE and X stands for a class of objects.

? A cursor variable has the data type REF CURSOR ? A cursor is static, but a cursor variable is dynamic ? Cursor variables give you more flexibility.

Defining REF CURSOR Types ? Define a REF CURSOR type

TYPE ref_type_name IS REF CURSOR [RETURN return_type]; ? Declare a cursor variable of that type Ref_cv ref_type_name; ? Example

DECLARE

TYPE deptcurtyp IS REF CURSOR RETURN departments%type Dept_cv deptcurtyp; 例:(open… for…) Begin

Open dept_cv FOR ‘SQLSTR’ [USING]…; LOOP

FETCH dept_cv INTO 行變量 END LOOP; END;

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库Oracle9i笔记2(4)在线全文阅读。

Oracle9i笔记2(4).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/540344.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: