Skip to Main Content
  • Questions
  • Changes that affect all_object tables

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, John.

Asked: May 02, 2018 - 5:58 pm UTC

Last updated: May 03, 2018 - 4:07 am UTC

Version: 12.03

Viewed 1000+ times

You Asked

Hi TOM,


Which actions can change the dates on the table all_objects? For example if I debug a package today 5-May-2018 at 17:00:00, the last_ddl_time and timestamp will be updated with the time that the debug was done?

Regards,
John Juma

and Connor said...

Anything and everything that is DDL. Even if that DDL is performed implicitly (ie, we compiled a procedure when you tried to run it), eg

SQL> create table t ( x int );

Table created.

SQL>
SQL> create or replace
  2  procedure p is
  3  begin
  4    insert into t values (1);
  5  end;
  6  /

Procedure created.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        VALID   03/05/2018 12:03:02
T                                        VALID   03/05/2018 12:03:02

2 rows selected.

SQL> drop table t purge;

Table dropped.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        INVALID 03/05/2018 12:03:02

1 row selected.

SQL> alter procedure p compile;

Warning: Procedure altered with compilation errors.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        INVALID 03/05/2018 12:03:27

1 row selected.

SQL> alter procedure p compile debug;

Warning: Procedure altered with compilation errors.

SQL> sho err
Errors for PROCEDURE P:

LINE/COL ERROR
-------- ----------------------------------------------------------------
3/3      PL/SQL: SQL Statement ignored
3/15     PL/SQL: ORA-00942: table or view does not exist
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        INVALID 03/05/2018 12:03:44

1 row selected.

SQL> create table t ( x int );

Table created.

SQL>
SQL> exec p

PL/SQL procedure successfully completed.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        VALID   03/05/2018 12:04:20
T                                        VALID   03/05/2018 12:04:20

2 rows selected.

SQL>
SQL> alter procedure p compile debug;

Procedure altered.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        VALID   03/05/2018 12:04:30
T                                        VALID   03/05/2018 12:04:20

2 rows selected.

SQL>




Is this answer out of date? If it is, please let us know via a Comment

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.