The following is a general guide on how to run installation scripts for various types of database objects:
Package specifications Tables (with constraints and indexes) in proper order Sequences (because they are most often used by triggers) Triggers Synonyms Views (because they may reference functions, procedures, or synonyms) Package bodies Data (optionally disabling all constraints before loading the data and re-enabling them afterwards)
Package specifications are listed first because they will always be valid, and other objects can reference them. Packaging bodies must be the last type of object created because they are likely to refer to other types of objects. Due to dependency issues, you are encouraged to put functions and procedures in packages.
source share