Oracle AFTER/BEFORE CREATE ON DATABASE 触发器:如何访问对象源
我正在尝试为 Oracle 实现伪版本控制和存储库。 这个想法是:当存储的函数/过程被更改或创建的全局数据库时 触发触发器,这将获取已修改对象的当前源并存储它们 到一张桌子。 所以我使用两个触发器:
TRIGGER BEFORE_MODIFY before ALTER or CREATE ON DATABASE
TRIGGER AFTER_MODIFY after ALTER or CREATE ON DATABASE
一切正常,除了 AFTER_MODIFY 触发器看到编译对象的旧版本(源)。 我尝试从 SYS.SOURCE$.SOURCE 获取源,并再次尝试从 dbms_metadata.get_ddl(OBJ_TYPE, OBJ_NAME, OBJ_OWNER) 获取相同的结果。
我正在寻找建议或明确的答案,例如“你不能在 Oracle 10g+ 中做到这一点”。
I am trying to implement pseudo version control and repository for Oracle.
The idea is: when a stored function/procedure is altered or a created global DATABASE
trigger is fired, which would grab the current sources of a modified object and store them
to a table.
So I'm using two triggers:
TRIGGER BEFORE_MODIFY before ALTER or CREATE ON DATABASE
TRIGGER AFTER_MODIFY after ALTER or CREATE ON DATABASE
Everything works fine, except the AFTER_MODIFY trigger sees an old version (sources) of the compiled object.
I have tried to get sources from SYS.SOURCE$.SOURCE
and as a second try from dbms_metadata.get_ddl(OBJ_TYPE, OBJ_NAME, OBJ_OWNER)
with same results.
I am looking for advice or a definite answer such as "You can't do it in Oracle 10g+".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
建议您只使用 ora_sql_txt 来获取新代码:
Suggest you just use ora_sql_txt to get the new code: