title: How do I fix SQL Error: ORA-00001: unique constraint (ALERTS2.PK_UP_MODULE_MASTER) violated
body: <p>Gives me error when I try to insert and it finally inserts after couple of retries with out any error.</p>
  
  <pre><code>SQL Error: ORA-00001: unique constraint (ALERTS2.PK_UP_MODULE_MASTER) violated.
  
  *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
  </code></pre>
  
  <p><strong>INSERT statement:</strong></p>
  
  <pre><code>INSERT INTO up_module_master 
              ( 
                          mr_id, 
                          mr_name, 
                          mr_desc, 
                          mr_parent, 
                          created_by, 
                          created_date, 
                          modified_date, 
                          module_type, 
                          module_link, 
                          link_text, 
                          help_text shortcut_link, 
                          shortcut_name, 
                          shortcut_flag, 
                          module_display_name 
              ) 
  SELECT max(u1.mr_id)+1, 
         'Notification Engine', 
         'Notification Engine Module', 
         0,1, 
         SYSDATE, 
         '', 
         '', 
         '../../jalsweb/Logout.jsp', 
         'HTTP', 
         '', 
         '', 
         '', 
         0, 
         'Notification Engine' 
  FROM   up_module_master u1;
  </code></pre>
  
  <p><strong>Below is the table definition:</strong></p>
  
  <pre><code>CREATE TABLE "up_module_master" 
    ( 
       "mr_id"               NUMBER (10, 0) NOT NULL ENABLE, 
       "mr_name"             VARCHAR2 (200 byte) NOT NULL ENABLE, 
       "mr_desc"             VARCHAR2 (250 byte), 
       "mr_parent"           NUMBER, 
       "created_by"          NUMBER, 
       "created_date"        TIMESTAMP (6), 
       "modified_date"       TIMESTAMP (6), 
       "module_type"         VARCHAR2 (100 byte), 
       "module_link"         VARCHAR2 (200 byte), 
       "link_text"           VARCHAR2 (250 byte), 
       "help_text"           VARCHAR2 (250 byte), 
       "shortcut_link"       VARCHAR2 (400 byte), 
       "shortcut_name"       VARCHAR2 (100 byte), 
       "shortcut_flag"       NUMBER, 
       "module_display_name" VARCHAR2 (100 byte), 
       "audit_type"          VARCHAR2 (100 byte), 
       "service_id"          NUMBER, 
       "module_regis_type"   NUMBER DEFAULT 1, 
       CONSTRAINT "PK_UP_MODULE_MASTER" PRIMARY KEY ("mr_id"), 
       CONSTRAINT "UP_MODULE_MASTER_UP_MODUL_FK1" FOREIGN KEY ("mr_parent") 
       REFERENCES "up_module_master" ("mr_id") ENABLE 
    ) 
  </code></pre>