Unique Constraint Violations On Import

Cleaning up your application before attempting to use version control is definitely a good idea!

As we were getting everything setup, we started having Unique Constraint Violations during import (running $base/install.sql with SQL*Plus).  After some investigating it became clear that our application’s themes were a bit of a mess.   We had multiple themes in the application, which I’m sure isn’t considered a best practice.  The themes were 101. Initialized and 3. Business Look.

What happened was, theme 101 defined a Page Template called Login, as did theme 3.  During the export split, it creates
$base/application/shared_components/user_interface/templates/page/login.sql
for theme 3, then over writes that file when it gets to theme 101.  The reason for this is that the export splitter doesn’t anticipate multiple themes, and as such places all page templates in the same directory. Your export’s $base/install.sql will now contain two references to this login.sql — the second time it @includes login.sql you’ll get a unique constraint exception.

Once you know this is the problem, the solution is simple, take the time to cleanup your themes!

I don’t think it’s fair to consider this a bug in the application export splitter, but it could be avoided if it were altered to create using a structure like

Avoid Naming Collisions

Avoid Naming Collisions

Posted in APEX (Application Express), Change Management

Leave a Reply

Alan Warren

Alan Warren

These days I develop software using the Oracle Database, and Application Express (APEX). Outside of work I enjoy cottaging, trivia, and billiards. I'm a long time resident of Guelph, Ontario Canada.

View Full Profile →

Subscribe

Enter your email address to subscribe to this blog and receive notifications of new posts by email.