Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle trigger

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

-- Create table a trigger

Create table T_AC_TEST

(

ID VARCHAR2 (32) not null primary key

AT_SWITCH CHAR (1)

AT_UPDATE_TIME DATE

AT_UPDATE_MAN VARCHAR2 (50)

)

-- add several pieces of data

Select * from t_ac_test for update

-- verify the trigger to create a new b table

Create table T_AC_TEST1

(

ID VARCHAR2 (32) not null primary key

AT_SWITCH CHAR (1)

AT_UPDATE_MAN VARCHAR2 (50)

)

-- add several pieces of data

Select * from T_AC_TEST1 for update

-- create a trigger. The corresponding function is that when the content of table an is modified, table b saves the modified contents of table a.

Create or replace trigger tri_ins_EST_MOTHERFUCKER-create trigger

After update-modified operation

On ACT.t_Ac_Test-the table after on is the table to be modified act is the table to be modified by the owner of the table t _ ac_test

For each row-indicates that the row-level trigger is created

Begin

Insert into ACT.t_Ac_Test1 (ID,AT_SWITCH,AT_UPDATE_MAN)

Values

(: NEW. ID

: NEW.AT_SWITCH

: NEW.AT_UPDATE_MAN)

End

-- create a trigger

Create or replace trigger tri_test--

Before delete--

On ACT.t_Ac_Test-- on act t _ ac_test

For each row

Begin

Insert into ACT.t_Ac_Test1 (ID,AT_SWITCH,AT_UPDATE_MAN)

Values

(: NEW. ID

: NEW.AT_SWITCH

: NEW.AT_UPDATE_MAN)

End

-- query statements for 2 tables

Select * from t_ac_test1

Select * from t_ac_test

Modify table a trigger stone execution and check whether the contents of table b have fields modified by table a

Update T_AC_TEST t set t.at_update_man =''where t. Id =' 4028810f3bb26aa2013bb2babe450099'

Delete from t_ac_test where id = '4028810f3bb26aa2013bb2babe450088'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report