??? create
view
v_test
as
???
?
select
t11.a a1,t11.b b1,t22.a a2,t22.b b2
??? ???
from
t11 ,t22
???
?
where
t11.a = t22.a;
??? create
or
replace
trigger
view_trigger
???
?
instead
of?--等同于after
???
?
update
???
?
on
v_test
???
?
for
each
row
??? begin
???
?
update
t11
set
b=:new.b1
where
a=:new.a1;
??? end
;
??? create
or
replace
teigger dbstart_trigger
???
?
after
startup
???
?
on
database
??? begin
???
?
insert
into
t1_log
values
(
sysdate
);
??? end ;
??? create
or
replace
teigger logon_trigger
???
?
after
logon
??? ? on schema??--若用on database則任何登陸均會觸發
??? begin
???
?
insert
into
t1_log
values
(user,
sysdate
);
??? end ;
SQL > desc user_triggers
Name
?????????????
Type
?????????? Nullable
Default
Comments??????????????? ???????????????????????????????????????????????????
----------------- -------------- -------- ------- ---------------------------------------------------------------------------
TRIGGER_NAME?????
VARCHAR2
(
30
)?? Y???????????????
Name
of
the
trigger
????????????????????????????????????????????????????????
TRIGGER_TYPE?????
VARCHAR2
(
16
)?? Y???????????????
Type
of
the
trigger
(
when
it fires) -
BEFORE
/
AFTER
and
STATEMENT
/
ROW
???????
TRIGGERING_EVENT?
VARCHAR2
(
227
)? Y???????????????
Statement
that will fire
the
trigger
-
INSERT
,
UPDATE
and
/
or
DELETE
????????
TABLE_OWNER??????
VARCHAR2
(
30
)?? Y??????????????? Owner
of
the
table
that this
trigger
is
associated
with
????????????????????
BASE_OBJECT_TYPE?
VARCHAR2
(
16
)?? Y?????????????????????????????????????? ????????????????????????????????????????????????????
TABLE_NAME???????
VARCHAR2
(
30
)?? Y???????????????
Name
of
the
table
that this
trigger
is
associated
with
?????????????????????
COLUMN_NAME??????
VARCHAR2
(
4000
) Y???????????????
The
name
of
the
column
on
which
the
trigger
is
defined over????????????????
REFERENCING_NAMES
VARCHAR2
(
128
)? Y??????????????? Names used
for
referencing
to
OLD
,
NEW
and
PARENT
values
within
the
trigger
WHEN_CLAUSE??????
VARCHAR2
(
4000
) Y???????????????
WHEN
clause must evaluate
to
true
in
order
for
triggering
body
to
execute
??
STATUS???????????
VARCHAR2
(
8
)??? Y???????????????
If
DISABLED
then
trigger
will
not
fire?????????????????????????????????????
DESCRIPTION
??????
VARCHAR2
(
4000
) Y???????????????
Trigger
description
, useful
for
re-creating
trigger
creation
statement
?????
ACTION_TYPE??????
VARCHAR2
(
11
)?? Y???????????????????????????????????????????????????????????????????????????????????????????
TRIGGER_BODY????? LONG ?????????? Y??????????????? Action taken by this trigger when it fires?????????????????????????????????