Not sure if that is intentional, but the behavior is different between SQL Developer for VS Code and SQLcl on the one hand and SQL*Plus, TOAD and most likely other existing tools on the other hand.
Compile the following code using SQL Developer for VS Code. Written in one line for easier analysis, but unrelated.
CREATE OR REPLACE PROCEDURE test_proc AS BEGIN NULL; END test_proc;
/
SELECT obj.last_ddl_time, src.text
FROM user_objects obj
JOIN user_source src ON ( src.name = obj.object_name )
WHERE obj.object_name = 'TEST_PROC';
The source has a newline at the end of the last line:
"LAST_DDL_TIME" "TEXT"
"2024-11-14 13:09:44" "PROCEDURE test_proc AS BEGIN NULL; END test_proc;
"
Subsequent compiles with tools with the same behavior do not change the LAST_DDL_TIME
any more.
Compiling the same procedure with SQL*Plus results in no newline after the last line and also modifies the LAST_DDL_TIME
:
"LAST_DDL_TIME" "TEXT"
"2024-11-14 13:20:29" "PROCEDURE test_proc AS BEGIN NULL; END test_proc;"
Switching between tools that behave differently seems to circumvent Oracle's detection if a source has changed, so it is compiled from scratch which usually takes longer, updates LAST_DDL_TIME
and in case of packages with state, it will be reset (ORA-04068: existing state of packages has been discarded
).