Today something very stupid happened. I’ve managed to lose the changes of an entire package. As you know if a package is opened in two different sessions, like session A and session B, if changes are made from session A to the package and session B still has the package opened, when session B will make its changes, all modifications performed by session A on the opened package will be lost. Thanks God that I was able to retrieve the lost changes by making use of SYS.SOURCE$ table. This table is composed from 3 columns: OBJ# which represents the object ID, LINE which is the line number of the source in the object, and SOURCE the column which store the line of code.

SELECT * FROM SYS.SOURCE$;
SELECT * FROM SYS.SOURCE$ WHERE SOURCE LIKE ‘%MYPACKAGE%’;

After digging into the results returned, I was able to find 3 versions of my package. One of them contained the lost changes.

You can find more details about SYS.SOURCE$ table here.