网站首页
网站导航
Ctrl+D收藏
首 页
代码段
源码包
文档库
工具箱
代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
PLSQL
】
Oracle 触发器 插入,更新,删除,数据同步,两表同步
作者:
Dezai.CN
/ 发布于
2012-12-13
/
1195
建表: create table User_Info ( ID INTEGER not null, UserName VARCHAR(30) not null, PassWord VARCHAR(20) not null, CreateDate Date not null, Status INTEGER not null, constraint PK_User_Info primary key (ID) ); create table User_Info_temp ( ID INTEGER not null, UserName VARCHAR(30) not null, PassWord VARCHAR(20) not null, CreateDate Date not null, Status INTEGER not null, constraint PK_User_Info_temp primary key (ID) ); 触发器写法: create or replace trigger UserToTemp after insert or update or delete on user_info for each row declare integrity_error exception; errno integer; errmsg char(200); dummy integer; found boolean; begin if inserting then insert into User_info_temp(ID,UserName,PassWord,CreateDate,Status) values(:NEW.ID,:NEW.UserName,:NEW.PassWord,:new.CreateDate,:NEW.Status); elsif updating then update User_info_temp set ID=:NEW.ID,UserName=:NEW.UserName,PassWord=:NEW.PassWord,Status=:NEW.Status where id=:OLD.id; elsif deleting then delete from User_info_temp where id=:OLD.id; end if; exception when integrity_error then raise_application_error(errno, errmsg); end; 测试数据: insert into user_info(ID,UserName,PassWord,CreateDate,Status)values(1,'xier','222',to_date('2008-10-11','yyyy-mm-dd'),1) update user_info u set u.status=3,u.username='xier' where u.id=1 delete from user_info u where u.id=1
评论列表
本站所提供的代码,版权归原作者所有,若有侵犯作者版权,请与我们联系,我们将立即删除或修改。谢谢!
本站所有代码发布及提供者。
试试其它关键字
Oracle
触发器
同语言下
.
查看某张表的表结构
.
oracle 集合操作
.
for 循环中倒序 用reverse
.
Oracle 临时表空间收缩
.
查看session及其对应运行的sql
.
Oracle常用查看表结构命令
.
Oracle Connect By Prior用法(实现递归查询)
.
重置排序 SEQUENCE
.
创建一个trigger
.
批量替换字段中的字符
可能有用的
.
android 通过Build获取手机硬件信息
.
Android代码获取手机品牌、手机型号、手机唯一序列号
.
SQL SERVER 查询每日新增用户数量、次留数量
.
获取浏览器滚动条宽度
.
利用Cookie保存数据,在浏览器页面显示用户上次访问时
.
Map集合中嵌套list
.
html5将文字生成图片
.
文字浮在图片上方
.
HTML中怎样在图片的右边显示文字
.
利用ffmpeg将MP4文件切成ts和m3u8
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
地图
本站
我们
服务
版权
联系
回馈
博客