There are different types of objects in oracle database. Normally what happens is that you create a schema and then compile your object scripts which will create the objects like tables, procesures, packages, links, synonyms, views etc.
When there is change in the codebase, you could just simply compile the scripts. This could miss something time and again and you will have problem in the production. What I prefer is to delete all the objects, ie clean the schema and then compile it and do the processing.
Here is a simple script/query in oracle which will generate queries to delete different objects in oracle.
When there is change in the codebase, you could just simply compile the scripts. This could miss something time and again and you will have problem in the production. What I prefer is to delete all the objects, ie clean the schema and then compile it and do the processing.
Here is a simple script/query in oracle which will generate queries to delete different objects in oracle.
select drop_objects from ( SELECT CASE object_type WHEN 'TABLE' THEN 'DROP table '||object_name||' CASCADE CONSTRAINTS;' WHEN 'VIEW' THEN 'DROP VIEW '||object_name||';' WHEN 'SEQUENCE' THEN 'DROP SEQUENCE '||object_name||';' WHEN 'SYNONYM' THEN 'DROP SYNONYM '||object_name||';' WHEN 'FUNCTION' THEN 'DROP FUNCTION '||object_name||';' WHEN 'PROCEDURE' THEN 'DROP PROCEDURE '||object_name||';' WHEN 'PACKAGE' THEN 'DROP PACKAGE '||object_name||';' WHEN 'PACKAGE BODY' THEN 'DROP PACKAGE BODY '||object_name||';' WHEN 'TYPE' THEN 'DROP TYPE '||object_name||';' WHEN 'TYPE BODY' THEN 'DROP TYPE BODY '||object_name||';' WHEN 'MATERIALIZED VIEW' THEN 'DROP MATERIALIZED VIEW '||object_name||';' END drop_objects FROM USER_objects ) where 1=1 and drop_objects is not null ;