Get DDL for any object with a query with Oracle

Have you ever wonder how the DB Client tools such as SQL Developer, TOAD and so on..
get the DDL to for you?


Well, I wonder that as well, and it is easy to get, that is META_DATA of the database right?
You can access any object DDL with a query:

Here are just some examples of this:

And this is how looks like the result set.
Important Note:

  • Any object can be queried, index, package, procedures, triggers and so on..
  • Object name is case sensitive, so you should be able to find it only if you use the same casing, otherwise will return an error as follows, my_function does not exist, what exist is MY_FUNCTION:


Comments