SQL 如何确定存储过程最后一次在 Oracle 中修改或编译的时间?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/297392/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I find out when a stored procedure was last modified or compiled in Oracle?
提问by ninesided
I'm preferably looking for a SQL query to accomplish this, but other options might be useful too.
我最好寻找 SQL 查询来完成此操作,但其他选项也可能有用。
回答by WW.
SELECT LAST_DDL_TIME, TIMESTAMP
FROM USER_OBJECTS
WHERE OBJECT_TYPE = 'PROCEDURE'
AND OBJECT_NAME = 'MY_PROC';
LAST_DDL_TIME
is the last time it was compiled.
TIMESTAMP
is the last time it was changed.
LAST_DDL_TIME
是最后一次编译。
TIMESTAMP
是最后一次更改。
Procedures may need to be recompiled even if they have not changed when a dependency changes.
过程可能需要重新编译,即使它们在依赖项更改时没有更改。
回答by Keerthi
SELECT name, create_date, modify_date
FROM sys.procedures order by modify_date desc
回答by nayakam
Following query will do in Oracle
以下查询将在 Oracle 中执行
SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME = 'OBJ_NAME' ;
回答by Samuel ?slund
I got here when googling for finding PLSQL packages changed after a specific date, a little bit similar to the question above. Using WW.s answer above I got to this query for finding any "recently" changed objects:
我是在谷歌搜索找到特定日期后更改的 PLSQL 包时到达这里的,有点类似于上面的问题。使用上面的 WW.s 答案我得到了这个查询以查找任何“最近”更改的对象:
SELECT LAST_DDL_TIME, TIMESTAMP, OBJECT_NAME, object_type FROM USER_OBJECTS WHERE -- OBJECT_TYPE IN ( 'PROCEDURE', 'PACKAGE', 'PACKAGE BODY', 'VIEW', 'FUNCTION' ) AND TIMESTAMP > '2019-02-20' ORDER BY TIMESTAMP DESC;