Get a list of all functions and procedures in an Oracle database

后端 未结 3 1434
南笙
南笙 2020-12-04 12:17

I\'m comparing three Oracle schemas.

I want to get a list of all the functions and procedures used in each database. Is this possible via a query? (preferably includ

相关标签:
3条回答
  • 2020-12-04 12:24

    Do a describe on dba_arguments, dba_errors, dba_procedures, dba_objects, dba_source, dba_object_size. Each of these has part of the pictures for looking at the procedures and functions.

    Also the object_type in dba_objects for packages is 'PACKAGE' for the definition and 'PACKAGE BODY" for the body.

    If you are comparing schemas on the same database then try:

    select * from dba_objects 
       where schema_name = 'ASCHEMA' 
         and object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' )
    minus
    select * from dba_objects 
    where schema_name = 'BSCHEMA' 
      and object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' )
    

    and switch around the orders of ASCHEMA and BSCHEMA.

    If you also need to look at triggers and comparing other stuff between the schemas you should take a look at the Article on Ask Tom about comparing schemas

    0 讨论(0)
  • 2020-12-04 12:31
     SELECT * FROM all_procedures WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE') 
     and owner = 'Schema_name' order by object_name
    

    here 'Schema_name' is a name of schema, example i have a schema named PMIS, so the example will be

    SELECT * FROM all_procedures WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE') 
    and owner = 'PMIS' order by object_name
    

    Ref: https://www.plsql.co/list-all-procedures-from-a-schema-of-oracle-database.html

    0 讨论(0)
  • 2020-12-04 12:35
    SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE')
    

    The column STATUS tells you whether the object is VALID or INVALID. If it is invalid, you have to try a recompile, ORACLE can't tell you if it will work before.

    0 讨论(0)
提交回复
热议问题