读书人

oracle创设触发器调用含参数存储过程

发布时间: 2013-03-26 21:09:10 作者: rapoo

oracle创建触发器调用含参数存储过程

背景:在向数据表中插入数据时调用已定义的存储过程,对插入数据进行xml解析,该存储过程含参数,

解决方法:为插入数据表建立触发器,在触发器中调用存储过程

存储过程:请参见上一篇博客文章 oracle中使用存储过程解析xml字符串

插入语句为:insert into t_xml(2, ‘<item><cpu_name>name1</cpu_name><value>80%</value></item>’)

触发器建立:

create orreplace triggerTRG_t_PARSE

beforeinsert ont_xml

referencing

foreach row

declare

-- local variables here

--pragma autonomous_transaction;--自治事务,子事务可以有commit

begin

p_parse(:new.id); --调用存储过程,传参数:new.id

--commit;

endTRG_t_PARSE;


我的异常网推荐解决方案:oracle存储过程,http://www.myexception.cn/oracle-develop/177537.html

读书人网 >其他数据库

热点推荐