Toad World® Forums

Context (scope) of <%UniqueNumber%>


after adopting TDM for a week I found out this software nice piece of work, but one thing is still bothering me and I’m not able to find out myself - even with help of this forum. My problem is with names of check constraints on domains. I want to have all constraints have this naming conventions:

<table_name>_c . must be unique in the scope of the table. I create domain name “Validity” NUMBER(1, 0) with simple check constraint <%ColumnName%> IN (0, 1).

Name of this constraint is defined as <%TableName%>_c<%UniqueNumber%>.

This works fine until there are more columns with same domain in same table (which is hardly possible with “Validity”, but this is just example), because after generating DDL there are two columns with same check constrain name. Example:

validity1 NUMBER(1,0) DEFAULT 1 NOT NULL
CONSTRAINT TEST_TDM_C1 CHECK (validity1 IN (0, 1)),
validity2 NUMBER(1,0) DEFAULT 1 NOT NULL
CONSTRAINT TEST_TDM_C1 CHECK (validity2 IN (0, 1)),

So, it seems that context of <%UniqueNumber%> is somehow different then I expected - it generates same name in one table. I suppose that <%UniqueNumber%> variable will be unique at least for one table, one domain, one model or even better to some user defined sequence. Another problem is there is no way how to find out these same named constraints before generating DDL and importing script into database - verification of model do not work with names generated by domains - or I’m missing something?

Is there some way how to force TDM to generate really unique names?

Thanks for any help.

P.S. My TDM version is


the next BETA version (should be available next week) will contain new application variable <%AttributeOrder%> that can be used on table level. Solution can be achieved by setting the name to something like “<%TableName%>_c<%AttributeOrder%>".



Thanks Vaclav for reply, looking forward to new version.

Context of <%UniqueNumber%> is mystery still for me…


For your example is context of <%UniqueNumber%> Domain - list of check constraint.

You can define default name of a check constraint as “MyName<%UniqueNumber%>”. Each check constrain in the same domain will have unique number.

For domain you should not use this design. You should rather use <%AttributeOrder%>.



Thanks! Now its clear.



in new Toad Data Modeler 5.2 BETA is naming convention “<%TableName%>_c<%AttributeOrder%>" working as expected.

Thanks everyone involved!