I’ve previously talked about Domains…this is the concept where say you want to have a JSON column in your Oracle TABLE, but you always want it defined the same way, e.g. as a CLOB.

Or maybe you have a NAME column, and you always wants names stored as a VARCHAR2(256).

If you open the Domains Administration dialog, you can create a new Domains file, and add your version of the TRUTH. This is stored in an XML file…somewhere.

Open this from the Tools menu.

You want to SOURCE CONTROL/VERSION this file. It gets stored outside your design.

Time to start that new project!

If we start by opening a new design, we’ll notice our domains aren’t present. BOO. HISS.

What do I do now?

Import the domain

File – Import – Domains

Navigate to the XML file you’ve stored your Domains in, select it. That should load the list.

Review, do we have what we think we want?

Check the domains you want to import, and click OK.

Now back to our Design tree, under Domains we’ll see our list.

And if I go into a new TABLE and add a couple of columns, one for a name and one for some JSON, we can preview the DDL…and all is right with the world again.

I’m lazy AND strict, so I’ve built the CHECK constraint into my JSON Domain.

Let’s end on a trick

If you’ve been a reader for the past 8 years, you probably already know this one, but I find repetition is key for retention and really groking a topic.

When building out TABLEs, you’re going to be selecting from a set of data types over and over again. And there are a TON of data types to choose from, esp as you get into newer and newer versions of Oracle Database.

So, the tip is – tell us in Preferences, what you want to see by default. Hint: you don’t want to see everything by default!

I want to see Domains first, and these are the data types I want to see.

I setup my preferred data types first, and then I setup my domains. I also say, let’s default with Domains when creating a new column SO I don’t forget about them.

Yes, I need to change my Default RDBMS Type to 12cR2!

Now, let’s see what we see when defining the properties of our new column.

It wants me to pick from these Domains…note that I have the ‘Preferred’ checkbox, checked.

Or if I switch over to Logical:

Why select from 36 data types, when I can keep to the ones I prefer?

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

3 Comments

  1. Jeff,

    We’ve got a huge logical model that was created with domains. When we export the model and then import the model, non of the domains are transported with the model.

    So, we went and found the defaultdomains.xml file and imported it into SDDM.

    We then imported the export of the logical model, but despite the domains being there… Everything in the logical model was set to ‘Logical Data Types’ instead of ‘Domain Data Types’.

    Any thoughts?

    Thanks for all you do!

    Rich

    • How do you mean, “Export the model?”

      Also, I’d probably post this to the Data Modeler Community…

Write A Comment