欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

oracle觸發(fā)器怎么插入,oracle 觸發(fā)器 高級(jí)用法

如何寫一個(gè)ORACLE觸發(fā)器出發(fā)插入數(shù)據(jù)?

A3表,字段t1,t2,t3

目前創(chuàng)新互聯(lián)建站已為千余家的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、網(wǎng)站托管運(yùn)營、企業(yè)網(wǎng)站設(shè)計(jì)、陽西網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。

A4表,字段t1,t2,t3

以下觸發(fā)器,功能是:在往A3表插入數(shù)據(jù)后觸發(fā),將剛剛插入的一行的數(shù)據(jù)插入表A4.

create

or

replace

trigger

t1

after

insert

on

a3

for

each

row

begin

--將剛插入行的字段t1,t2,t3插入表A4中

insert

into

a4

values(:new.t1,:new.t2,:new.t3);

end;

oracle觸發(fā)器,往表1(a,b,c)中插入一條數(shù)據(jù),若已存在則更新,否則則直接插入

可以使用insert觸發(fā)器

create trigger tgr_tablename_insert

on tablename

for insert --插入觸發(fā)

as

declare @num int

select @num = count(1) from tablename tb where tb.a = inserted.a and tb.b = inserted.b and tb.c = inserted.c

if @num 0

begin

insert.......

end

else

begin

update....

end

go

沒有測(cè)試下,不知道對(duì)不對(duì),你可以看著修改下,用的是sqlserver的語法

oracle觸發(fā)器將數(shù)據(jù)插入到另一個(gè)服務(wù)器的oracle數(shù)據(jù)庫中?

oracle觸發(fā)器將數(shù)據(jù)插入到另一個(gè)服務(wù)器的oracle數(shù)據(jù)庫中要用dblink實(shí)現(xiàn)兩臺(tái)服務(wù)器的數(shù)據(jù)共享。

oracle db_link 和觸發(fā)器實(shí)現(xiàn)不同數(shù)據(jù)庫表的同步

---創(chuàng)建dblink,dblink_test名稱,(被同步數(shù)據(jù)庫的a_test)ST10766用戶名,ep密碼,ass100連接字符串

create public database link dblink_test

connect to ST10766 identified by ep

using 'ass100';

---刪除dblink

----drop public database link dblink_test;

----建立表

create table a_test (id int,name varchar(20),pass varchar(20))

select * from a_test;

insert into a_test (id,name,pass) values (1,'zzn','shanshan')

insert into b_test (id,username,password) values('1','zxl','xiaolan')

----在目的數(shù)據(jù)庫上,測(cè)試dblink,查詢的是源數(shù)據(jù)庫的表

select * from a_test@dblink_orc10;

select * from a_test;

----創(chuàng)建觸發(fā)器

create or replace trigger a_b_test

after insert or update or delete

on a_test

for each row

begin

if deleting then

delete from b_test where id=:old.id;

end if;

if inserting then

insert into b_test(id,username,password) //b_test表的字段

values(:new.id,:new.name,:new.pass); //a_test表的字段

end if;

if updating then

update b_test set username=:new.name,password=:new.pass where id=:old.id;

end if;

end a_b_test;

當(dāng)前文章:oracle觸發(fā)器怎么插入,oracle 觸發(fā)器 高級(jí)用法
本文鏈接:http://chinadenli.net/article34/dsehhpe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT小程序開發(fā)做網(wǎng)站商城網(wǎng)站網(wǎng)站內(nèi)鏈微信小程序

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計(jì)公司