获取package的last_ddl_time问题

You have TWO objects in DBA_OBJECTS for a package, the package and the package body. If the interface doesn't change, LAST_DDL_TIME isn't updated for the package - but is for the package body.
ORACLE-SQL> @foo
Package created.
Package body created.
ORACLE-SQL> select object_name, object_type
  2            
ORACLE-SQL>
ORACLE-SQL> ed
Wrote file afiedt.buf

  1  select object_name, object_type, last_ddl_time
  2  from user_objects
  3* where object_name = 'FOO'
ORACLE-SQL> /

OBJECT_NAME
------------------------------------------------------------------------
--------
OBJECT_TYPE        LAST_DDL
------------------- --------
FOO
PACKAGE         22:10:05
FOO
PACKAGE BODY        22:10:06
ORACLE-SQL> save pack
Created file pack.sql
ORACLE-SQL> ed foo
[ some change to the package body]
ORACLE-SQL> @foo
Package created.
Package body created.
ORACLE-SQL> @pack
OBJECT_NAME
------------------------------------------------------------------------
--------
OBJECT_TYPE        LAST_DDL
------------------- --------
FOO
PACKAGE         22:10:05
FOO
PACKAGE BODY        22:11:38
ORACLE-SQL>
Be aware that the last_ddl_time is updated for grants so the date value may not reflect an actual code change but may be the result of just a grant.  My test shows only the specification date gets changed.

UT1 > select object_type, to_char(last_ddl_time,'YYYYMMDD HH24:MI:SS') LTIME
  2  from dba_objects
  3  where object_name = 'DBA_MSG'
  4  and object_type like 'PACKAGE%'
  5  /

OBJECT_TYPE        LTIME
------------------ -----------------
PACKAGE            20090728 16:32:17
PACKAGE BODY       20090120 15:37:15

UT1 > grant execute on mark.dba_msg to public
  2  /

Grant succeeded.

UT1 > select object_type, to_char(last_ddl_time,'YYYYMMDD HH24:MI:SS') LTIME
  2  from dba_objects
  3  where object_name = 'DBA_MSG'
  4  and object_type like 'PACKAGE%'
  5  /

OBJECT_TYPE        LTIME
------------------ -----------------
PACKAGE            20090728 16:36:01
PACKAGE BODY       20090120 15:37:15

转载于:https://www.cnblogs.com/theurgy/archive/2009/08/17/1547818.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值