Domains and Check Constraints

I would like to add three new domains with names, datatypes, and check constraints as follows:

  1. flag, varchar2(1), <attr/clmn> in (‘N’,‘Y’);
  2. date, date, trunc(<attr/clmn>) = <attr/clmn> (i.e., ensures time component is always 00:00:00 and can be ignored); and
  3. datetime, date, no chk cons (i.e., time component is meaningful)

I’m building the model in the LER and performing a model conversion to the PER.

Defining the rules, check constraints, variable column names (<attr/clmn>), and the interaction between the rules and check constraints is confusing.

I’d appreciate any pointers.

I’m following up my question with an answer and, what appears to be, a bug.

LER

  • Create Rule rul_Flag with Rule Properties -> SQL set to: %ColumnName% in (‘N’,‘Y’).
  • Create Domain dom_Flag with datatype VarChar(%p1), Length 1 and Rule set to rul_Flag.
  • Create attribute active_flag with Domain dom_Flag.

Use Simple Model Conversion to transform LER to PER.

PER

  • Attribute active_flag has dom_Flag as its Domain.
  • SQL Preview for the entity shows: … active_flag Varchar2(1 ) NOT NULL CHECK (–active_flag in (‘N’,‘Y’)) …

Close … but with the addition of a comment delimeter (–) in my check constraint.

Any ideas on how to get rid of the double-dash?

Thanks.

Hello,

Instead of Simple Model Conversion, please use the Sync & Convert Wizard (File menu | Sync & Convert | Sync & Convert Wizard).
On page Action, select Convert Model… Go through the steps and on page Settings, take notice of the “Comment Out Database Specific Items” checkbox.
Feel free to select or clear it.

Regards,

Vladka + TDM Team

Clearing the checkbox fixed the problem.

Thanks.

Brian