pt数据库的触发器的写法

作者:jinsedeme  发布日期:2011-10-28 14:55:55
create table delete_action (datname name, procpid integer, usesysid int, usename name, current_query text, xact_start timestamp with time zone, query_start timestamp with time zone, client_pid integer);

CREATE OR REPLACE TRIGGER delete_action_tri after DELETE ON software.tbl_swm_softcpatchinfo 
FOR EACH ROW
BEGIN 

	insert into delete_action(datname, procpid, usesysid, usename, current_query, xact_start, query_start, client_pid) select datname, procpid, usesysid, usename, current_query, xact_start, query_start, client_pid from pg_stat_activity where current_query like '%tbl_swm_softcpatchinfo%';

	exception
		when others then
		null;
end;

延伸阅读:

Tag标签: 数据库触发器  
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规