:[IBM][ODBC Oracle Wire Protocol driver][Oracle]ORA-00001: unique constraint (SC

悠悠隱於市發表於2011-06-12

今天在做一個WebSPhere Message Broker 簡單的練習,使用Compute節點訪問oracle資料庫.

 

第一次插入的時候,資料正常插入,沒有報錯,第二次插入,則報了一個違反唯一約束..是因為表主鍵不能重複.

 

解決方案:

把主鍵設定唯一的就能插入進去.

 

 

錯誤資訊:

Insert
         Type:INTEGER:5
         Text:CHARACTER:INSERT INTO Database.RECORDS ( ID, NAME, ADDRESS, AMOUNT1, AMOUNT2 )  VALUES (oututRecords.id, oututRecords.name, oututRecords.address, CAST(oututRecords.amount1 AS DECIMAL(8, 2)), CAST(oututRecords.amount2 AS DECIMAL(8, 2)) )
       DatabaseException
         File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbOdbc.cpp
         Line:INTEGER:341
         Function:CHARACTER:ImbOdbcHandle::checkRcInner
         Type:CHARACTER:
         Name:CHARACTER:
         Label:CHARACTER:
         Catalog:CHARACTER:BIPmsgs
         Severity:INTEGER:3
         Number:INTEGER:2321
         Text:CHARACTER:Root SQL exception
         Insert
           Type:INTEGER:2
           Text:CHARACTER:-1
         Insert
           Type:INTEGER:14
           Text:CHARACTER:odbc32.dll
         DatabaseException
           File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbOdbc.cpp
           Line:INTEGER:480
           Function:CHARACTER:ImbOdbcHandle::checkRcInner
           Type:CHARACTER:
           Name:CHARACTER:
           Label:CHARACTER:
           Catalog:CHARACTER:BIPmsgs
           Severity:INTEGER:3
           Number:INTEGER:2322
           Text:CHARACTER:Child SQL exception
           Insert
             Type:INTEGER:5
             Text:CHARACTER:23000
           Insert
             Type:INTEGER:2
             Text:CHARACTER:1
           Insert
             Type:INTEGER:5
             Text:CHARACTER:[IBM][ODBC Oracle Wire Protocol driver][Oracle]ORA-00001: unique constraint (SCOTT.SYS_C005425) violated

相關文章