How to get the version of the files?

vamsi kasina's picture
articles: 

For Packages:

   SELECT text
   FROM all_source
   WHERE name = UPPER('&package_name')
   AND line = 2;


From the PROD TOP / AU TOP:
   SQL Files / Packages   -> $PROD_TOP/patch/115/sql
   Views/Tables (odf)     -> $PROD_TOP/patch/115/odf
   Tables/Indexes (xdf)   -> $PROD_TOP/patch/115/xdf
   Forms (fmb)            -> $PROD_TOP/forms/US
   Reports (rdf)          -> $PROD_TOP/reports/US
   Libraries (pll)        -> $PROD_TOP/resource
   Source Files           -> $PROD_TOP/src
   Java Files             -> $PROD_TOP/java
   OAF Pages              -> $PROD_TOP/mds
   lct Files (FNDLOAD)    -> $PROD_TOP/patch/115/import
   ldt Files (FNDLOAD)    -> $PROD_TOP/patch/115/import/US
   Data Templates (rtf)   -> $PROD_TOP/patch/115/publisher/templates/US
   Data Definitions (xml) -> $PROD_TOP/patch/115/publisher/defs
   Business Event Subscriptions (Workflow) -> $PROD_TOP/patch/115/xml/US

Use strings <<file path / file name>> | grep 'Header'
For Patch Application:
   SELECT af.app_short_name
         ,af.subdir
         ,af.filename
         ,afv.version
   FROM ad_files af
       ,ad_file_versions afv
   WHERE  af.file_id = afv.file_id
   AND af.filename   = '&file_name'
   ORDER BY af.app_short_name
           ,af.subdir
           ,afv.creation_date DESC;

To order on version:

   SELECT af.app_short_name
         ,af.subdir
         ,af.filename
         ,afv.version
   FROM ad_files af 
       ,ad_file_versions afv 
   WHERE  af.file_id = afv.file_id 
   AND af.filename   = '&file_name'
   ORDER BY af.app_short_name
           ,af.subdir
           ,afv.version_segment1 DESC
           ,afv.version_segment2 DESC
           ,afv.version_segment3 DESC
           ,afv.version_segment4 DESC
           ,afv.version_segment5 DESC;