ORA-1779?? (I have unique index defined)

I execute the query:
UPDATE
(select rec.cod_instalacion_marca cod_instal_marca_RECLAMAC, ins.cod_instalacion_marca cod_instal_marca_DIM_INST_MAR
from ods.RECLAMAC rec
INNER JOIN master_dwh.DIM_MODELOS mod ON (rec.cod_modelo = mod.cod_modelo)
INNER JOIN master_dwh.DIM_INSTAL_MARCAS ins ON (rec.taller_implicado = ins.cod_instalacion and mod.cod_marca = ins.cod_marca))
SET cod_instal_marca_RECLAMAC = cod_instal_marca_DIM_INST_MAR
And I received the error:
ORA-01779: cannot modify a column that maps to a non-key preserved column
But I have:
*) Primary key in the field: ins.cod_instalacion_marca (table: master_dwh.DIM_INSTAL_MARCAS)
*) Unique Key in the fields: ins.cod_instalacion + ins.cod_marca (table: master_dwh.DIM_INSTAL_MARCAS).
How can I solve it???
Thanks very much!

I’m sorry,
But the table RECLAMAC is the table I want to modify!!! I can’t define unique key in this field (rec.cod_instalacion_marca ) because is the field that I want to modify and the values could repeat and that is correct.
I read for example the AskTom Followup:
You NEED a primary key/unique constraint on object_id in T1 to ensure that each row in T joins to AT MOST 1 row in T1.
Consider, if T had:
OBJECT_NAME OBJECT_ID
ABC xxxx
and T1 had:
OBJECT_NAME OBJECT_ID
ABC 123
ABC 456
what should be the outcome of:
ADHOC@VOYAGER> update
2 (select t.object_id toid,t1.object_id t1oid
3 from t,t1
4 where t.object_name=t1.object_name
5 and upper(t.object_name)='PRIMARY_SALESFORCE')
6 set toid=t1oid;
should T have 123 or 456 and under what circumstances? Since the outcome of
that update is 100% AMBIGOUS, we do not permit it. We need to ensure key
preserved-ness and do that with a primary key/unique constraint.
You need that index anyway typically for performance.
But my T1 table in the AskTom example is DIM_INSTAL_MARCAS and I have defined the unique key: ins.cod_instalacion + ins.cod_marca
Look at this:
If I create the field cod_marca in the table RECLAMAC and execute this query, it is executed OK!!!!!!
UPDATE
(select rec.cod_instalacion_marca cod_instal_marca_RECLAMAC, ins.cod_instalacion_marca cod_instal_marca_DIM_INST_MAR
from ods_clientes.EXP_RECLAMACIONES_EXPEDIENTES rec
INNER JOIN maestros_dwh.DIM_INSTALACIONES_MARCAS ins ON (rec.taller_implicado = ins.cod_instalacion and rec.cod_marca = ins.cod_marca))
SET cod_instal_marca_RECLAMAC = cod_instal_marca_DIM_INST_MAR
But if I execute:
UPDATE
(select rec.cod_instalacion_marca cod_instal_marca_RECLAMAC, ins.cod_instalacion_marca cod_instal_marca_DIM_INST_MAR
from ods.RECLAMAC rec
INNER JOIN master_dwh.DIM_MODELOS mod ON (rec.cod_modelo = mod.cod_modelo)
INNER JOIN master_dwh.DIM_INSTAL_MARCAS ins ON (rec.taller_implicado = ins.cod_instalacion and mod.cod_marca = ins.cod_marca))
SET cod_instal_marca_RECLAMAC = cod_instal_marca_DIM_INST_MAR
I receive the error ORA-01779: cannot modify a column that maps to a non-key preserved column
I NEED IT...
What unique index I have to create?
Thanks very much!

Similar Messages

  • ERROR ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found

    Hi,
    SAPSSRC.log
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: START OF LOG: 20071018195059
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: sccsid @(#) $Id: //bas/640_REL/src/R3ld/R3load/R3ldmain.c#12 $ SAP
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: version R6.40/V1.4
    Compiled Nov 30 2005 20:41:21
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe -ctf I C:/temp/51030721/EXP2/DATA/SAPSSRC.STR C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\ORA\NUC\DB/DDLORA.TPL C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\ORA\NUC\DB/SAPSSRC.TSK ORA -l C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\ORA\NUC\DB/SAPSSRC.log
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: job completed
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: END OF LOG: 20071018195059
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: START OF LOG: 20071018195133
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: sccsid @(#) $Id: //bas/640_REL/src/R3ld/R3load/R3ldmain.c#12 $ SAP
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: version R6.40/V1.4
    Compiled Nov 30 2005 20:41:21
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe -dbcodepage 4103 -i C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\ORA\NUC\DB/SAPSSRC.cmd -l C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\ORA\NUC\DB/SAPSSRC.log -stop_on_error
    DbSl Trace: ORA-1403 when accessing table SAPUSER
    (DB) INFO: connected to DB
    (DB) INFO: DbSlControl(DBSL_CMD_NLS_CHARACTERSET_GET): WE8DEC
    (DB) INFO: ABTREE created #20071018195134
    (IMP) INFO: import of ABTREE completed (39 rows) #20071018195134
    (DB) INFO: ABTREE~0 created #20071018195134
    (DB) INFO: AKB_CHKCONF created #20071018195134
    (IMP) INFO: import of AKB_CHKCONF completed (0 rows) #20071018195134
    (DB) INFO: AKB_CHKCONF~0 created #20071018195134
    (DB) INFO: AKB_INDX created #20071018195134
    (IMP) INFO: import of AKB_INDX completed (0 rows) #20071018195134
    (DB) INFO: AKB_INDX~0 created #20071018195134
    (DB) INFO: AKB_USAGE_INFO created #20071018195134
    (IMP) INFO: import of AKB_USAGE_INFO completed (0 rows) #20071018195134
    (DB) INFO: AKB_USAGE_INFO~0 created #20071018195134
    (DB) INFO: AKB_USAGE_INFO2 created #20071018195134
    (IMP) INFO: import of AKB_USAGE_INFO2 completed (0 rows) #20071018195134
    (DB) INFO: AKB_USAGE_INFO2~0 created #20071018195134
    (DB) INFO: APTREE created #20071018195134
    (IMP) INFO: import of APTREE completed (388 rows) #20071018195134
    (DB) INFO: APTREE~0 created #20071018195134
    (DB) INFO: APTREE~001 created #20071018195134
    (DB) INFO: APTREET created #20071018195134
    (IMP) INFO: import of APTREET completed (272 rows) #20071018195134
    DbSl Trace: Error in exec_immediate()
    DbSl Trace: ORA-1452 occurred when executing SQL statement (parse error offset=35)
    (DB) ERROR: DDL statement failed
    (CREATE UNIQUE INDEX "APTREET~0" ON "APTREET" ( "SPRAS", "ID", "NAME" ) TABLESPACE PSAPBW1 STORAGE (INITIAL 44981 NEXT 0000000040K MINEXTENTS 0000000001 MAXEXTENTS 2147483645 PCTINCREASE 0 ) )
    DbSlExecute: rc = 99
    (SQL error 1452)
    error message returned by DbSl:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    (DB) INFO: disconnected from DB
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: job finished with 1 error(s)
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: END OF LOG: 20071018195134
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: START OF LOG: 20071018195314
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: sccsid @(#) $Id: //bas/640_REL/src/R3ld/R3load/R3ldmain.c#12 $ SAP
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: version R6.40/V1.4
    Compiled Nov 30 2005 20:41:21
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe -dbcodepage 4103 -i C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\ORA\NUC\DB/SAPSSRC.cmd -l C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\ORA\NUC\DB/SAPSSRC.log -stop_on_error
    DbSl Trace: ORA-1403 when accessing table SAPUSER
    (DB) INFO: connected to DB
    (DB) INFO: DbSlControl(DBSL_CMD_NLS_CHARACTERSET_GET): WE8DEC
    (DB) ERROR: DDL statement failed
    (DROP INDEX "APTREET~0")
    DbSlExecute: rc = 103
    (SQL error 1418)
    error message returned by DbSl:
    ORA-01418: specified index does not exist
    (IMP) INFO: a failed DROP attempt is not necessarily a problem
    DbSl Trace: Error in exec_immediate()
    DbSl Trace: ORA-1452 occurred when executing SQL statement (parse error offset=35)
    (DB) ERROR: DDL statement failed
    (CREATE UNIQUE INDEX "APTREET~0" ON "APTREET" ( "SPRAS", "ID", "NAME" ) TABLESPACE PSAPBW1 STORAGE (INITIAL 44981 NEXT 0000000040K MINEXTENTS 0000000001 MAXEXTENTS 2147483645 PCTINCREASE 0 ) )
    DbSlExecute: rc = 99
    (SQL error 1452)
    error message returned by DbSl:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    (DB) INFO: disconnected from DB
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: job finished with 1 error(s)
    C:\usr\sap\BW1\SYS\exe\run/R3load.exe: END OF LOG: 20071018195315
    I'm getting this error "duplicate keys found". I'm finished installing the central instance and during the database instance, i got this error. I'm installing BW 3.5 on x64 windows server 2003 platform. I'm using NU kernel 6.40.
    Thanks for your suggestions on how to resolve this error.
    Reward points guaranteed.

    Issue solved by deleting central and database instance and started a new build. it finished without an error.
    Thank you.

  • W_PARTY_D_U1 = ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found.

    Hi,
    We are implementing OBIA 11.1.1.7.1 which comes with ODI for Fianance and Procurement analytics.When we do full load from EBS the load plan gets failed and it throws the below error
    Caused By: java.sql.SQLException: ORA-20000: Error creating Index/Constraint : W_PARTY_D_U1 => ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found.
    Please help us to resolve the same.
    Thanks
    Rama

    This might need Patch:10402735
    if helps mark

  • Unique Index Error while running the ETL process

    Hi,
    I have Installed Oracle BI Applications 7.9.4 and Informatica PowerCenter 7.1.4. I have done all the configuration steps as specified in the Oracle BI Applications Installation and Configuration Guide. While running the ETL process from DAC for Execution Plan 'Human Resources Oracle 11.5.10' some tasks going to status Failed.
    When I checked the log files for these tasks, I found the following error
    ANOMALY INFO::: Error while executing : CREATE INDEX:W_PAYROLL_F_ASSG_TMP:W_PRL_F_ASG_TMP_U1
    MESSAGE:::java.lang.Exception: Error while execution : CREATE UNIQUE INDEX
    W_PRL_F_ASG_TMP_U1
    ON
    W_PAYROLL_F_ASSG_TMP
    INTEGRATION_ID ASC
    ,DATASOURCE_NUM_ID ASC
    ,EFFECTIVE_FROM_DT ASC
    NOLOGGING PARALLEL
    with error java.sql.SQLException: ORA-12801: error signaled in parallel query server P000
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    EXCEPTION CLASS::: java.lang.Exception
    I found some duplicate rows in the table W_PAYROLL_F_ASSG_TMP with the combination of the columns on which it is trying to create INDEX. Can anyone give me information for the following.
    1. Why it is trying to create the unique index on the combination of columns which may not be unique.
    2. Is it a problem with the data in the source database (means becoz of duplicate rows in the source system).
    How we need to fix this error. Do we need to delete the duplicate rows from the table in the data warehouse manually and re-run the ETL process or is there any other way to fix the problem.

    This query will identify the duplicate in the Warehouse table preventing the Index from being built:
    select count(*), integration_id, src_eff_from_dt from w_employee_ds group by integration_id, src_eff_from_dt having count(*)>1;
    To get the ETL to finish issue this delete to the W_EMPLOYEE_DS table:
    delete from w_employee_ds where integration_id = '2' and src_eff_from_dt ='04-JAN-91';
    To fix it so this does not happen again on another load you need to find the record in the Vision DB, it is in the PER_ALL_PEOPLE_F table. I have a Vision source and this worked:
    select rowid, person_id , LAST_NAME FROM PER_ALL_PEOPLE_F
    where EFFECTIVE_START_DATE = '04-JAN-91';
    ROWID PERSON_ID
    LAST_NAME
    AAAWXJAAMAAAwl/AAL 6272
    Kang
    AAAWXJAAMAAAwmAAAI 6272
    Kang
    AAAWXJAAMAAAwmAAA4 6307
    Lee
    delete from PER_ALL_PEOPLE_F
    where ROWID = 'AAAWXJAAMAAAwl/AAL';

  • UNIQUE INDEX and PRIMARY KEYS

    Hi Friends,
    I am confused about primary keys.
    What is the purpose of this key again? I know it is used for unique constraints.
    Supposing I have a table with two (2) columns which are each indexed as unique.
    Then they can me both candidate at primary key right?
    So why do I need a primary key again? when I have 2 columns which are uniquely index?
    Thanks a lot

    A UNIQUE index creates a constraint such that all values in the index must be distinct. An error occurs if you try to add a new row with a key value that matches an existing row. This constraint does not apply to NULL values except for the BDB storage engine. For other engines, a UNIQUE index allows multiple NULL values for columns that can contain NULL
    The differences between the two are:
    1. Column(s) that make the Primary Key of a table cannot be NULL since by definition; the Primary Key cannot be NULL since it helps uniquely identify the record in the table. The column(s) that make up the unique index can be nullable. A note worth mentioning over here is that different RDBMS treat this differently –> while SQL Server and DB2 do not allow more than one NULL value in a unique index column, Oracle allows multiple NULL values. That is one of the things to look out for when designing/developing/porting applications across RDBMS.
    2. There can be only one Primary Key defined on the table where as you can have many unique indexes defined on the table (if needed).
    3. Also, in the case of SQL Server, if you go with the default options then a Primary Key is created as a clustered index while the unique index (constraint) is created as a non-clustered index. This is just the default behavior though and can be changed at creation time, if needed.
    So, if the unique index is defined on not null column(s), then it is essentially the same as the Primary Key and can be treated as an alternate key meaning it can also serve the purpose of identifying a record uniquely in the table.

  • Unique Index Created Automatically on FK Columns

    Referencing the following document under Forward Engineering, http://www.oracle.com/technetwork/developer-tools/datamodeler/newfeatures30-224506.html
    Unique index is created for One-to-one relationships defined in the Logical model if there is no PK/UK constraint or unique index defined over foreign key columns.
    Why are unique indexes created automatically for foreign key columns? Should "lookups" not be defined in the logical model? I don't understand why it's designed to behave that way.

    Why are unique indexes created automatically for foreign key columns? They are created automatically only for 1:1 relationships in order to support that business rule.
    Should "lookups" not be defined in the logical model? Can you elaborate on that?
    Philip

  • ORA-01502 error in case of unusable unique index and bulk dml

    Hi, all.
    The db is 11.2.0.3 on a linux machine.
    I made a unique index unusable, and issued a dml on the table.
    Howerver, oracle gave me ORA-01502 error.
    In order to avoid ORA-01502 error, do I have to drop the unique index ,and do bulk dml, and recreate the index?
    Or Is there any other solution without re-creating the unique index?
    create table hoho.abcde as
    select level col1 from dual connect by level <=1000
    10:09:55 HOHO@PD1MGD>create unique index hoho.abcde_dx1 on hoho.abcde (col1);
    Index created.
    10:10:23 HOHO@PD1MGD>alter index hoho.abcde_dx1 unusable;
    Index altered.
    Elapsed: 00:00:00.03
    10:11:27 HOHO@PD1MGD>delete from hoho.abcde where rownum < 11;
    delete from hoho.abcde where rownum < 11
    ERROR at line 1:
    ORA-01502: index 'HOHO.ABCDE_DX1' or partition of such index is in unusable stateThanks in advance.
    Best Regards.

    Hi. all.
    The following is from "http://docs.oracle.com/cd/E14072_01/server.112/e10595/indexes002.htm#CIHJIDJG".
    Is there anyone who can show me a tip to avoid the following without dropping and re-creating an unique index?
    •DML statements terminate with an error if there are any unusable indexes that are used to enforce the UNIQUE constraint.
    Unusable indexes
    An unusable index is ignored by the optimizer and is not maintained by DML. One reason to make an index unusable is if you want to improve the performance of bulk loads. (Bulk loads go more quickly if the database does not need to maintain indexes when inserting rows.) Instead of dropping the index and later recreating it, which requires you to recall the exact parameters of the CREATE INDEX statement, you can make the index unusable, and then just rebuild it. You can create an index in the unusable state, or you can mark an existing index or index partition unusable. The database may mark an index unusable under certain circumstances, such as when there is a failure while building the index. When one partition of a partitioned index is marked unusable, the other partitions of the index remain valid.
    An unusable index or index partition must be rebuilt, or dropped and re-created, before it can be used. Truncating a table makes an unusable index valid.
    Beginning with Oracle Database 11g Release 2, when you make an existing index unusable, its index segment is dropped.
    The functionality of unusable indexes depends on the setting of the SKIP_UNUSABLE_INDEXES initialization parameter.
    When SKIP_UNUSABLE_INDEXES is TRUE (the default), then:
    •DML statements against the table proceed, but unusable indexes are not maintained.
    •DML statements terminate with an error if there are any unusable indexes that are used to enforce the UNIQUE constraint.
    •For non-partitioned indexes, the optimizer does not consider any unusable indexes when creating an access plan for SELECT statements. The only exception is when an index is explicitly specified with the INDEX() hint.
    •For a partitioned index where one or more of the partitions are unusable, the optimizer does not consider the index if it cannot determine at query compilation time if any of the index partitions can be pruned. This is true for both partitioned and non-partitioned tables. The only exception is when an index is explicitly specified with the INDEX() hint.
    When SKIP_UNUSABLE_INDEXES is FALSE, then:
    •If any unusable indexes or index partitions are present, any DML statements that would cause those indexes or index partitions to be updated are terminated with an error.
    •For SELECT statements, if an unusable index or unusable index partition is present but the optimizer does not choose to use it for the access plan, the statement proceeds. However, if the optimizer does choose to use the unusable index or unusable index partition, the statement terminates with an error.Thanks in advance.
    Best Regards.

  • Hi i have created a unique index on table on 3 columns.

    Hi i have created a unique index on table on 3 columns.I want to know when i have 2 records
    which contain same values in 2 fields and the 3rd field contains a null
    will unique index allow me to insert these records.

    Robert Angel wrote:
    This must be one time when null = null. ;)
    regards,
    Robert.Not really, it is more the case that the non-null columns need to be unique. Your second attempt failed because there was already an index entry with 'a', 'b', and the lack of a value for column c gave Oracle no way to differentiate between the two rows so they are not unique.
    A subtle, but conceptually important difference. :-)
    John

  • Unique Index vs. Unique Constraint

    Hi All,
    I'm studying for the Oracle SQL Expert Certification. At one point in the book, while talking about indices, the author says that a unique index is not the same a unique constraint. However, he doesn't explain why they're two different things.
    Could anyone clarify the difference between the two, please?
    Thanks a lot,
    Valerio

    A constraint has different meaning to an index. It gives the optimiser more information and allows you to have foreign keys on the column, whereas a unique index doesn't.
    eg:
    SQL> create table t1 (col1 number, col2 varchar2(20), constraint t1_uq unique (col1));
    Table created.
    SQL> create table t2 (col1 number, col2 varchar2(20));
    Table created.
    SQL> create unique index t2_idx on t2 (col1);
    Index created.
    SQL> create table t3 (col1 number, col2 number, col3 varchar2(20), constraint t3_fk
      2                   foreign key (col2) references t1 (col1));
    Table created.
    SQL> create table t4 (col1 number, col2 number, col3 varchar2(20), constraint t4_fk
      2                   foreign key (col2) references t2 (col1));
                     foreign key (col2) references t2 (col1))
    ERROR at line 2:
    ORA-02270: no matching unique or primary key for this column-listIt's like saying "What's the difference between a car seat and an armchair? They both allow you to sit down!"

  • ORA-1779 when updating a view

    Hi and thanks in advance !
    i am facing a critical situation.
    i have two schema & both are same!
    the problem which i am facing is during updating a view of one i am facing above error while the same DML is issuing againt that view in other schema and that works fine.
    what's the reason..
    The major difference between two schema's is i hav different live and test database i migrate my access database to Oracle test database # 1.here i created a new user name deals . ok
    i hav done same migration in my another database but a little difference here user deals is already available here and tables and views are also available i drop all the object but forget to purge recyclebin. now whenever i try to issue DML at this schema i am facing above error while the same tables same data and same view is available in above databae where my update statement executed properly. one more thing i like to add here i hav some unwanted trigger 'BIN$##$$%##$# bla bla bla' on different table. i haven't created that .
    here is the view for your kind perusal
    CREATE OR REPLACE VIEW QRYREUTER AS
    SELECT FXdeals.deal_no,
    cparty.name,
    cparty.city,
    FXdeals.brokbill,
    FXdeals.deal_date,
    FXdeals.mode_id
    FROM FXDeals
    JOIN cparty
    ON FXdeals.cpcode = cparty.cpcode
    WHERE ( ( (FXdeals.mode_id) = 3 ) )
    Message was edited by:
    Fiz Dosani

    but i have sample scenario in other schema which replica of this schema so why i haven't got this error there
    one more interesting thing when i query select * from user_updateable_columns where table name ='ABC' in Schema # 1 it return i can modify some columns.
    but when issue the data dictionary view in schema # 2, where i was facing ORA-1779 , select * from user_updateable_columns where table name ='ABC' in Schema # 2 it return i can not modify any columns.
    Tables name are same in both schema.
    Data same in both schema.
    Constraint Same in both schema.
    Indexes same in both schema.
    why facing error in one schema not in other.
    one more interesting thing, i had faced questionable object error when importing DMP into schema # 2.

  • Using UNUSABLE on Unique Index gives "initially in unusable state" error

    I am doing the following:
    1. Truncate table
    2 Alter PK Index Disable
    2. Alter Unique Index Unusable
    3. Insert /*+ APPEND NOLOGGING*/ into my table
    My problem is, I get an "ORA-26026: unique index ... initially in unusable state" error when I try to do the Insert. If I make the Unique index non-unique it isn't a problem. If I drop the index and recreate it its not a problem - so uniqueness doesn't appear to be the issue. Can you not use UNUSABLE with a Unique index, I couldn't find any reference to this in the 10g docs.
    I am using 10.1.0.4.
    Thanks
    Richard

    26026, 0000, "unique index %s.%s initially in unusable state"
    //* Cause: A unique index is in IU state (a unique index cannot have
    //* index maintenance skipped via SKIP_UNUSABLE_INDEXES).
    //* Action: Either rebuild the index or index partition, or use
    //* SKIP_INDEX_MAINTENANCE if the client is SQL*Loader.

  • Primary Key supported by a non-unique index?

    Encountered a weird situation today. A utility we setup which allows Analysts to restore data into their tables, started failing when it attempted to drop an index. The index was supporting a Primary Key. Makes sense. But our script was supposed to only be attempting to drop/recreate non-unique indexes. Turns out the supporting index on the Primary Key was non-unique, and to the best of my knowledge came about as follows:
    SQL> create table junk (f number(1));
    Table created.
    SQL> create index junk_ix on junk(f);
    Index created.
    SQL> select UNIQUENESS from DBA_INDEXES where index_name = 'JUNK_IX';
    UNIQUENES
    NONUNIQUE
    SQL> alter table forbesc.junk add constraint junk_pk primary key (f) using index junk_ix;
    Table altered.
    SQL> select UNIQUENESS from DBA_INDEXES where index_name = 'JUNK_IX';
    UNIQUENES
    NONUNIQUE
    SQL> insert into junk values (1);
    1 row created.
    SQL> insert into junk values (1);
    insert into junk values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (FORBESC.JUNK_PK) violated
    SQL> select index_name from dba_constraints where constraint_name = 'JUNK_PK';
    INDEX_NAME
    JUNK_IXWhat I can't figure out is how a non-unique index is enforcing uniqueness. I thought that it was the key in that very same process. I thought that perhaps an index with the 'SYS_123456' was getting created, perhaps, but I couldn't find one:
    SQL> select object_name, object_type from dba_objects order by created desc;
    OBJECT_NAME   OBJECT_TYPE
    JUNK_IX     INDEX
    JUNK     TABLE
    ...How is the uniqueness getting enforced in this case? This is in Oracle 11.1.0.7
    Thanks,
    --=Chuck

    It has always been that way. Oracle can, and will, use a non-unique index to enforce a PK constraint, The existing index just needs to have the PK column(s) as the leading column(s) of the index:
    SQL> create table t (id number, id1 number, descr varchar2(10));
    Table created.
    SQL> create index t_ids on t(id, id1);
    Index created.
    SQL> select index_name from user_indexes
      2  where table_name = 'T';
    INDEX_NAME
    T_IDS
    SQL> alter table t add constraint t_pk
      2  primary key (id);
    Table altered.
    SQL> select index_name from user_indexes
      2  where table_name = 'T';
    INDEX_NAME
    T_IDS
    SQL> insert into t values (1, 1, 'One');
    1 row created.
    SQL> insert into t values (1, 2, 'Two');
    insert into t values (1, 2, 'Two')
    ERROR at line 1:
    ORA-00001: unique constraint (OPS$ORACLE.T_PK) violatedJohn

  • Create unique index on flow table

    Hi
    I always get this error 'Create unique index on flow table ERROR" while implementing SCD2. Please help me.I have made an Update Key which is a combination of 4 columns that want a new row to be inserted if there is a change in data.One of the above columns is the EMPLOYEE ID,
    My surrogate key is the table's primary key but I have not defined it as a key in mapping and also I have turned off the Primary Key Constraint Option in Controls Panel as NO.
    Where am I wrong? Also please tell me what to take care off while making Natural Key ?

    There are two solutions:
    1. Only use uppercase in the table name
    2. go in Topology>Physical Architecture and edit the technology, then click on
    the "Language" tab and set "Object Delimiter" to empty.
    Thanks,
    Sutirtha

  • Creating an unique index instaed of using primary key index

    Hi ,
    I heard in a debate sometimes it's better to create a unique index on a column and using it instaed of using primary key index in oracle.I couldn't understand what the reason propely.
    Can anyone please help me in thsi topic if it is a valid one .
    Thanks in advance

    Hi,
    They are exactly NOT identical.
    1. Unique key can have NULL values where primary keys can't.
    2. Primary key is fundamentally those keys which do not change. I mean updating a primary key is not a good idea.
    SQL> drop table test;
    Table dropped.
    SQL> create table test ( a number(2));
    Table created.
    SQL> ed
    Wrote file afiedt.buf
      1* create unique index test_idx on test(a)
    SQL> /
    Index created.
    SQL> ed
    Wrote file afiedt.buf
      1* insert into test values(NULL)
    SQL> /
    1 row created.
    SQL> drop table test;
    Table dropped.
    SQL>
    SQL> create table test ( a number(2) primary key);
    Table created.
    SQL> insert into test values(NULL);
    insert into test values(NULL)
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("HR"."TEST"."A")
    SQL>Cheers,
    Edited by: Avinash Tripathi on Nov 24, 2009 11:17 AM

  • ORA-01654 unable to extend index

    Hello,
    while inserting a new record with this statment:
    INSERT INTO vocc.VOC_CM_ANNUNCIO ( ID_RECORD, TIPO_AZIONE, ID_VOC_OPERATORE, ID_ANN_FONTE, COD_NAZIONE,
    COD_REGIONE, COD_PROVINCIA, COD_COMUNE, LOCALITA_ESTERA, DATORE_LAVORO, FLG_PUBBLICA_DATORE,
    TELEFONO, FLG_PUBBLICA_TELEFONO, FAX, FLG_PUBBLICA_FAX, EMAIL, FLG_PUBBLICA_EMAIL, SITO_INTERNET,
    FLG_PUBBLICA_SITO_INTERNET, CLASSIFICAZIONE, POSIZIONE, NUMERO_POSTI, COD_CONTRATTO,
    COD_ORARIO_LAVORO, DURATA_CONTRATTO, NOTE, ETA_MINIMA, ETA_MASSIMA, COD_MILITARE, COD_AUTOMUNITO,
    COD_DISPONIBILITA_TRASFERTA, COD_DISPONIBILITA_TURNI, COD_DISPONIBILITA_FORMAZIONE,
    COD_FIGURA_PROFESSIONALE, COMPETENZE, DATA_PUBBLICAZIONE, DATA_SCADENZA, TIPO_RAPPORTO,
    FLG_FORMA ) VALUES (
    14781, 'ins', '20', '1', NULL, '01', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    , NULL, NULL, NULL, NULL, NULL, NULL, '3', NULL, NULL, NULL, 'Disponibili immediatamente'
    , '20', '50', NULL, NULL, NULL, NULL, NULL, '122504', NULL, '01/01/2006', '31/01/2006'
    , 'CLI', 'D');
    I got the following error.
    ORA-01654: unable to extend index VOCC.PK_VOC_CM_ANNUNCIO by 128 in tablespace VOCC_IDX
    Instead if I execute this statment:
    INSERT INTO vocc.VOC_CM_ANNUNCIO ( ID_RECORD, TIPO_AZIONE, ID_VOC_OPERATORE, ID_ANN_FONTE, COD_NAZIONE,
    COD_REGIONE, COD_PROVINCIA, COD_COMUNE, LOCALITA_ESTERA, DATORE_LAVORO, FLG_PUBBLICA_DATORE,
    TELEFONO, FLG_PUBBLICA_TELEFONO, FAX, FLG_PUBBLICA_FAX, EMAIL, FLG_PUBBLICA_EMAIL, SITO_INTERNET,
    FLG_PUBBLICA_SITO_INTERNET, CLASSIFICAZIONE, POSIZIONE, NUMERO_POSTI, COD_CONTRATTO,
    COD_ORARIO_LAVORO, DURATA_CONTRATTO, NOTE, ETA_MINIMA, ETA_MASSIMA, COD_MILITARE, COD_AUTOMUNITO,
    COD_DISPONIBILITA_TRASFERTA, COD_DISPONIBILITA_TURNI, COD_DISPONIBILITA_FORMAZIONE,
    COD_FIGURA_PROFESSIONALE, COMPETENZE, DATA_PUBBLICAZIONE, DATA_SCADENZA, TIPO_RAPPORTO,
    FLG_FORMA ) VALUES (
    1999, 'ins', '20', '1', NULL, '01', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    , NULL, NULL, NULL, NULL, NULL, NULL, '3', NULL, NULL, NULL, 'Disponibili immediatamente'
    , '20', '50', NULL, NULL, NULL, NULL, NULL, '122504', NULL, '01/01/2006', '31/01/2006'
    , 'CLI', 'D');
    I have no problem.
    select max(ID_RECORD) from vocc.VOC_CM_ANNUNCIO = 14785
    Could anyone please explain, how to solve this problem.
    Thank you,
    Regards,
    Lavinia

    Okay,
    this is table structure:
    CREATE TABLE VOC_CM_ANNUNCIO
    ID_RECORD NUMBER NOT NULL,
    TIPO_AZIONE VARCHAR2(3),
    ID_VOC_OPERATORE VARCHAR2(10),
    ID_ANN_FONTE VARCHAR2(20),
    COD_NAZIONE VARCHAR2(4),
    COD_REGIONE VARCHAR2(2),
    COD_PROVINCIA VARCHAR2(3),
    COD_COMUNE VARCHAR2(4),
    LOCALITA_ESTERA VARCHAR2(100),
    DATORE_LAVORO VARCHAR2(305),
    FLG_PUBBLICA_DATORE VARCHAR2(1),
    TELEFONO VARCHAR2(20),
    FLG_PUBBLICA_TELEFONO VARCHAR2(1),
    FAX VARCHAR2(20),
    FLG_PUBBLICA_FAX VARCHAR2(1),
    EMAIL VARCHAR2(50),
    FLG_PUBBLICA_EMAIL VARCHAR2(1),
    SITO_INTERNET VARCHAR2(105),
    FLG_PUBBLICA_SITO_INTERNET VARCHAR2(1),
    CLASSIFICAZIONE VARCHAR2(4),
    POSIZIONE VARCHAR2(300),
    NUMERO_POSTI VARCHAR2(3),
    COD_CONTRATTO VARCHAR2(4),
    COD_ORARIO_LAVORO VARCHAR2(3),
    DURATA_CONTRATTO VARCHAR2(2),
    NOTE VARCHAR2(200),
    ETA_MINIMA VARCHAR2(2),
    ETA_MASSIMA VARCHAR2(2),
    COD_MILITARE VARCHAR2(1),
    COD_AUTOMUNITO VARCHAR2(1),
    COD_DISPONIBILITA_TRASFERTA VARCHAR2(1),
    COD_DISPONIBILITA_TURNI VARCHAR2(1),
    COD_DISPONIBILITA_FORMAZIONE VARCHAR2(1),
    COD_FIGURA_PROFESSIONALE VARCHAR2(6),
    COMPETENZE VARCHAR2(300),
    DATA_PUBBLICAZIONE VARCHAR2(10),
    DATA_SCADENZA VARCHAR2(10),
    TIPO_RAPPORTO VARCHAR2(3),
    FLG_FORMA VARCHAR2(1)
    TABLESPACE VOCC_TBL
    PCTUSED 40
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 168K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    The PK is:
    CREATE UNIQUE INDEX PK_VOC_CM_ANNUNCIO ON VOC_CM_ANNUNCIO
    (ID_RECORD)
    NOLOGGING
    TABLESPACE VOCC_IDX
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    STORAGE (
    INITIAL 32K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    NOPARALLEL;
    And the tbl:
    CREATE TABLESPACE VOCC_IDX DATAFILE
    MINIMUM EXTENT 512K
    LOGGING
    DEFAULT STORAGE (
    INITIAL 1M
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    ONLINE
    PERMANENT
    EXTENT MANAGEMENT DICTIONARY;

Maybe you are looking for

  • 6 Buttons do not function on Satellite U400-10O after upgrading to Vista Ultimate

    Hi, I have upgraded my U400-10O from original Win Vista Home Premium to Vista Ultimate, installed each and every driver and utility program, (some of them, e.g. TVAP several times ;-) However could not succeed to operate the multimedia shortcut butto

  • Failure to communicate between composites on WLS

    SOA Suite plus AIA FP 11.1.1.5 on OLinux VM, JDev 11.1.1.5, WLS 10.3.4 I have deployed a chain of 3 separate composite applications so far… which will eventually be 5 in all. Starting with a Mediator composite (EBS) which needs to invoke the service

  • Problem installing Mac OS X Update on PowerBook G4

    I'm trying to install the Mac OS X Update Combined 10.5.5 on my PowerBook G4 but it can't open the installer package. It keeps saying the Bill of Materials was not found. Are there any answers to this please? Thanks, Colin

  • Migrate Exch 2010 databases to 2013

    I have a customer migrating from Exch 2010 to 2013. One of the last steps we have is to move 3 "Archive" databases from 2010 to 2013. For this discussion, an archive is as follows: When a user leaves the company, their mailbox is moved from a regular

  • Authotization Object UIU_COMP

    Hi, does anyone of you have experiences in configuring roles in CRM 2007? It seems that authorization object UIU_COMP is very infuencial to system behaviour. I am looking for a guide or something like this to understand the structure and the possibil