Constraint WWV_FLOW_COLLECTIONS_UK vialated: CREATE_COLLECTION_FROM_QUERY_B

Issue: ORA-00001: unique constraint (APEX_030200.WWV_FLOW_COLLECTIONS_UK) violated when using APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
Error ERR-1101 Unable to process function body returning query
Note that I am not able to reproduce this problem every time. It is very rare and occurs once in a week or two weeks.
I get this error when I call following procedure using APEX page having interactive report.
======================================================================
PROCEDURE create_collection(p_collection IN VARCHAR2, p_reset IN VARCHAR2 DEFAULT 'N')
AS
BEGIN
IF p_reset = 'Y' THEN
APEX_COLLECTION.DELETE_COLLECTION(p_collection_name => p_collection);
END IF;
IF NOT APEX_COLLECTION.COLLECTION_EXISTS(p_collection_name => p_collection)
THEN
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
p_collection_name => p_collection,
p_query =>
q'!SELECT a.view_name,
a.column_name1,
a.column_name2,
b.column_name4,
b.column_name5,
FROM view_A a, table_B b
WHERE a.view_name = b.table_name
ORDER BY a.view_name, b.column_name4!'
END IF;
END;
======================================================================
The procedure call is like: create_columns_collection(p_collection => 'EMP_SAL');
Please help.
Thanks,
Avi

A collection is unique to a specific APEX session. If you're encountering a unique key violation, then it must be happening for a particular user within their same session. This typically happens when a user attempts to go to a page, the page takes too long to render, so they click refresh on their browser after a couple seconds. Now you have two physically distinct database sessions in the database, each attempting to satisfy the user's page request. Obviously, the end user is going to see the results of only the most recent (second) page request - the results from the first page request will essentially go to /dev/null.
You can see how, if there is collection processing during this page request, that the creation of the collection and population of it could cause two sessions to clobber each other. One way to mitigate this is to serialize access to this page view.
Joel

Similar Messages

  • Unusual Primary Key Constraint violation

    When using Apex collections from time to time this unique constraint error happens.
    ORA-00001: unique constraint (FLOWS_030000.WWV_FLOW_COLLECTIONS_UK) violated
    Now, I can't figure out why this constraint would be happening as we check for the existence of a collection before trying to create one, and the constraint relies on a number of values which we can't modify.
    All of our collection operations are done using the following APEX_COLLECTION calls
    COLLECTION_MEMBER_COUNT
    COLLECTION_EXISTS
    CREATE_OR_TRUNCATE_COLLECTION
    ADD_MEMBER
    DELETE_MEMBERS
    As I don't modify any data inside of the collections using any methods other than these above API calls I'm a bit confused.
    It's almost impossible for me to reproduce the error as it happens very rarely, in addition, most of the time performing the same action again after the constraint error has happened will succeed.
    Any ideas what I might be doing that could cause this?
    Thanks in advance,
    Joe

    I'm not sure if this will help but here's some more info:
    1. The constraint being violated is not a primary key constraint but a unique constraint as defined by:alter table wwv_flow_collections$
        add constraint wwv_flow_collections_uk
        unique(session_id, user_id, flow_id, collection_name, security_group_id)
    /2. The CREATE_OR_TRUNCATE_COLLECTION procedure first checks for the existence of a collection with those 5 keys. If found, it does:    delete wwv_flow_collections$ where id = <the id of the existing collection>;This delete cascades to rows in wwv_flow_collection_members$.
    Then, whether the "truncate" occurred or not it does this:    insert into wwv_flow_collections$( collection_name ) values( upper(p_collection_name));3. The TRUNCATE_COLLECTION procedure requires that the named collection exists, fetches its ID and then:delete wwv_flow_collection_members$ m where m.collection_id = <the id of the existing collection>;4.Of the two scenarios Joe showed us, the first one creates the failure condition (assuming two concurrent sessions) by allowing an insert to be performed, i.e., the "create collection" action. Even if the first inserter takes a while to commit, the second one will wait on a lock until the first inserter commits, then it will attempt an insert and raise the UK violation. In the second scenario, nobody ever inserts; only deletes from collections_members$ are issued (assuming the create_collection procedure is never called).
    Scott
    P.S. My head hasn't hurt this bad since Vikas's background job puzzler (Re: Background jobs

  • Custom Error Messages for Database Constraint Violations Problem

    Hi
    I have added a custom message bundle for the model project as explained in
    37.8.3 in the Fusion Developer's Guide - How to customize error messages for database constraint violations.
    http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcadvgen.htm#BABEFGCI
    Constraint Name : SYS_C0018574
    And I have following CustomErrorMessages class
    public class DBCustomErrorMessages extends ListResourceBundle {
        private static final Object[][] sMessageStrings =
            new String[][] { { "SYS_C0018574",
                               "Existing Record Found" } };
        protected Object[][] getContents() {
            return sMessageStrings;
    }This works fine when I run application model and adding records to vialate the constraint. So it gives me following message
    (oracle.jbo.DMLConstraintException) Existing Record FoundBut when run ui project it does not fire.
    Still it gives the message
    ORA-00001: unique constraint (CCBS2.SYS_C0018574) violatedCould you please shed some light?
    Edited by: deshan on Mar 15, 2011 11:28 AM

    Please see the image.
    http://4.bp.blogspot.com/-Fna66p-W5Jw/TX7uSQqqBtI/AAAAAAAAAH0/D1APg6oAIxI/s1600/1.JPG
    Error in Application Module ORA-00001: unique constraint (CCBS2.SYS_C0018574) violated exception is different from ui project.
    Any hint?
    Thanks
    deshan
    Edited by: deshan on Mar 15, 2011 10:16 AM

  • Error while adding Image: ORA-00001: unique constraint

    Dear all,
    I have an error while adding images to MDM I can´t explain. I want to add 7231 images. About 6983 run fine. The rest throws this error.
    Error: Service 'SRM_MDM_CATALOG', Schema 'SRMMDMCATALOG2_m000', ERROR CODE=1 ||| ORA-00001: unique constraint (SRMMDMCATALOG2_M000.IDATA_6_DATAID) violated
    Last CMD: INSERT INTO A2i_Data_6 (PermanentId, DataId, DataGroupId, Description_L3, CodeName, Name_L3) VALUES (:1, :2, :3, :4, :5, :6)
    Name=PermanentId; Type=9; Value=1641157; ArraySize=0; NullInd=0;
    Name=DataId; Type=5; Value=426458; ArraySize=0; NullInd=0;
    Name=DataGroupId; Type=4; Value=9; ArraySize=0; NullInd=0;
    Name=Description_L3; Type=2; Value=; ArraySize=0; NullInd=0;
    Name=CodeName; Type=2; Value=207603_Img8078_gif; ArraySize=0; NullInd=0;
    Name=Name_L3; Type=2; Value=207603_Img8078.gif; ArraySize=0; NullInd=0;
    Error: Service 'SRM_MDM_CATALOG', Schema 'SRMMDMCATALOG2_m000', ERROR CODE=1 ||| ORA-00001: unique constraint (SRMMDMCATALOG2_M000.IDATA_6_DATAID) violated
    Last CMD: INSERT INTO A2i_Data_6 (PermanentId, DataId, DataGroupId, Description_L3, CodeName, Name_L3) VALUES (:1, :2, :3, :4, :5, :6)
    Name=PermanentId; Type=9; Value=1641157; ArraySize=0; NullInd=0;
    Name=DataId; Type=5; Value=426458; ArraySize=0; NullInd=0;
    Name=DataGroupId; Type=4; Value=9; ArraySize=0; NullInd=0;
    Name=Description_L3; Type=2; Value=; ArraySize=0; NullInd=0;
    Name=CodeName; Type=2; Value=207603_Img8085_gif; ArraySize=0; NullInd=0;
    Name=Name_L3; Type=2; Value=207603_Img8085.gif; ArraySize=0; NullInd=0;
    I checked all data. There is no such dataset in the database. Can anybody give me a hint how to avoid this error.
    One thing I wonder: The PermanentId is allways the same but I can´t do anything here.
    BR
    Roman
    Edited by: Roman Becker on Jan 13, 2009 12:59 AM

    Hi Ritam,
    For such issues, can you please create a new thread or directly email the author rather than dragging back up a very old thread, it is unlikely that the resolution would be the same as the database/application/etc releases would most probably be very different.
    For now I will close this thread as unanswered.
    SAP SRM Moderators.

  • Dynamic Creation of constraints.   Suggestion rqd

    Hai
    CREATE TABLE TDA
    ( PKNODAVE VARCHAR2(7 BYTE) NOT NULL ENABLE,
    DTCREATION DATE,
    DAVETRANSFERT VARCHAR2(7 BYTE),
    PKPARC NUMBER(5,0)
    ALTER TABLE TDA ADD CONSTRAINT PK_TDAV8 PRIMARY KEY (PKNODAVE)
    ALTER TABLE TDA ADD CONSTRAINT FK_TDA1 FOREIGN KEY (DAVETRANSFERT)
    REFERENCES TDA (PKNODAVE) ENABLE
    i have a requirement to create a child table constraints with on delete cascade.
    So i just did dynamic sql like this.
    DECLARE
    CURSOR tcur
    IS
    SELECT DISTINCT primary.table_name PARENT_TABLE ,
    foreign.table_name CHILD_TABLE ,
    foreign.constraint_name CHILD_CONSTRAINT ,
    col.column_name FOREIGN_COLUMN ,
    col1.column_name PRIMARY_COLUMN
    FROM all_constraints PRIMARY,
    all_constraints FOREIGN ,
    all_cons_columns col ,
    all_cons_columns col1
    WHERE foreign.constraint_type = 'R'
    AND foreign.R_OWNER = foreign.OWNER
    AND foreign.R_CONSTRAINT_NAME = primary.CONSTRAINT_NAME
    AND foreign.CONSTRAINT_NAME = col.CONSTRAINT_NAME
    AND foreign.OWNER = col.OWNER
    AND primary.CONSTRAINT_NAME = col1.CONSTRAINT_NAME
    AND primary.OWNER = col1.OWNER
    AND col.POSITION = col1.POSITION
    AND primary.owner ='LOCAL'
    AND primary.table_name ='TDA';
    v_drop_sql VARCHAR2 (300);
    v_create_sql VARCHAR2 (300);
    v_count NUMBER;
    v_t_name VARCHAR2 (30);
    v_t_child_constraint VARCHAR2(100);
    v_t_child_col_name VARCHAR2(100);
    v_t_parent_col_name VARCHAR2(100);
    v_t_child_table VARCHAR2(100);
    BEGIN
    FOR cur IN tcur
    LOOP
    v_t_name := NULL;
    v_create_sql := NULL;
    v_drop_sql := NULL;
    v_count := 0;
    v_t_child_table :=cur.child_table;
    v_t_child_col_name :=cur.foreign_column;
    v_t_parent_col_name :=cur.primary_column;
    v_t_name :=cur.child_table;
    v_t_child_constraint := cur.CHILD_CONSTRAINT;
    --v_drop_sql           := 'ALTER TABLE ' ||v_t_name||' drop constraint  '||v_t_child_constraint;
    -- EXECUTE IMMEDIATE v_drop_sql;
    v_create_sql := 'ALTER TABLE '||v_t_child_table|| ' ADD CONSTRAINT ' ||v_t_child_constraint||' FOREIGN KEY( '||v_t_child_col_name||')
    REFERENCES '||v_t_child_col_name||'('||v_t_parent_col_name||') ENABLE ON DELETE CASCADE';
    dbms_output.put_line(v_create_sql);
    EXECUTE IMMEDIATE v_create_sql;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(v_create_sql);
    END;
    the pl/sql preocedure executes successfullly. but there is not constaint created why...?
    Pls give your suggestions
    S

    Oracle beginner wrote:
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(v_create_sql);
    END;
    the pl/sql preocedure executes successfullly. but there is not constaint created why...?Are you sure it's executing successfully? You are capturing all exceptions with your WHEN OTHERS clause and ignoring any errors.

  • Duvida Sobre Tabela Constraints de Muitos para Muitos

    Bom dia, Pessoal.
    Tenho a seguinte duvida.
    Quando você tem uma tabela de muitos para muitos e parte das constraints das 2 FK contem o mesmo campo que é referencia a uma terceira tabela.
    Por exemplo:
    Tempos uma tabela cupom e uma tabela de documento financeiro. Para unir as 2 tenho uma tabela cupom_documento.
    Nesta tabela cupom_documento tenho uma fk com empresa, filial, ecf e sequencial do cupom.
    e nesta mesma tabela tenho uma fk com documento que contem empresa, filial, sequencial do documento.
    Empresa, filia estão nas 2 fk's
    Minha duvida é em questão de performance e índice por fk é mais performático que não tenha o mesmo campo como fk para esta tabela.
    Obs: Esta empresa e filiais são tabelas que referencia usada sem quase todas as tabelas..
    Jonas B.

    Olá, Jonas B.
    Quanto mais seletivo é o índice, melhor será a sua performance. Seletividade é a quantidade de valores distintos que uma coluna pode ter. Para o seu cenário, tente não construir uma grande PK (composta pelas FKs das tabelas cupom e documento) na tabela cupom_documento. Lembre-se que quanto menor for a busca/varredura pela chave no íncide, melhor será sua performance.
    Abraços.
    caadecarvalho

  • How to find the table name on which integrity constraint not found

    Hi All
    How to acheive this
    I have a lot of tables with lot of primary key - foreign key
    relationship.
    In plsql
    when any inserts happen in the child table & the corresponding row is not present in the parent table, we get an exception
    ORA-02291: integrity constraint (user1.ppk) violated - parent key not found
    On this exception , in the exception block i want to trap teh name of the parent table on which the primary key for the particular child table was not there
    Is it possible to retrieve the parent table in this way. I am looking for a generic plsql code block which can help to acheive this
    Regards

    scott@ORA92> SET SERVEROUTPUT ON
    scott@ORA92> DECLARE
      2    e_no_parent_key EXCEPTION;
      3    PRAGMA            EXCEPTION_INIT (e_no_parent_key, -2291);
      4    v_fk_cons       VARCHAR2 (61);
      5    v_owner            VARCHAR2 (30);
      6    v_parent_table  VARCHAR2 (61);
      7    v_pk_cons       VARCHAR2 (30);
      8    v_parent_column VARCHAR2 (30);
      9  BEGIN
    10    INSERT INTO emp (empno, deptno) VALUES (99, 60);
    11  EXCEPTION
    12    WHEN e_no_parent_key THEN
    13        -- extract schema.constraint_name from sqlerrm:
    14        v_fk_cons:= SUBSTR (SQLERRM,
    15                      INSTR (SQLERRM, '(') + 1,
    16                      INSTR (SQLERRM, ')') - (INSTR (SQLERRM, '(') + 1));
    17        DBMS_OUTPUT.PUT_LINE ('Foreign key constraint violated: ' || v_fk_cons);
    18        -- extract parent schema.table and parent key:
    19        SELECT owner, table_name, constraint_name
    20        INTO     v_owner, v_parent_table, v_pk_cons
    21        FROM     user_constraints
    22        WHERE     (owner, constraint_name) =
    23            (SELECT r_owner, r_constraint_name
    24             FROM     user_constraints
    25             WHERE     owner || '.' || constraint_name = v_fk_cons);
    26        DBMS_OUTPUT.PUT_LINE ('Parent table: ' || v_owner || '.' || v_parent_table);
    27        DBMS_OUTPUT.PUT_LINE ('Parent key: ' || v_owner || '.' || v_pk_cons);
    28        -- extract parent table columns:
    29        FOR rec IN
    30          (SELECT column_name
    31           FROM   user_cons_columns
    32           WHERE  owner = v_owner
    33           AND    table_name = v_parent_table
    34           AND    constraint_name = v_pk_cons)
    35        LOOP
    36          DBMS_OUTPUT.PUT_LINE
    37            ('Parent table column: ' || rec.column_name);
    38        END LOOP;
    39  END;
    40  /
    Foreign key constraint violated: SCOTT.FK_DEPTNO
    Parent table: SCOTT.DEPT
    Parent key: SCOTT.PK_DEPT
    Parent table column: DEPTNO
    PL/SQL procedure successfully completed.

  • Difference between unique constraint and unique index

    1. What is the difference between unique constraint and unique index when unique constraint is always indexed ? Which one is better in this case for better performance ?
    2. Is Composite index of 3 columns x,y,z better
    or having independent/ seperate indexes on 3 columns x,y,z is better for better performance ?
    3. It has been very confusing for me to decide which columns to index, I have indexed most foreignkey columns, is it a good idea ? We do lot of selects and DMLS on most of our tables. Is there any query that I can run and find out if indexes are really being used and if they are improving any performance. I have analyzed and computed my indexes using ANALYZE index index_name validate structure and COMPUTE STATISTICS;
    null

    1. Unique index is part of unique constraint. Of course you can create standalone unique index. But is is no point to skip the logical view of business if you spend same effort to achive.
    You create unique const. Oracle create the unique index for you. You may specify index characteristic in unique constraint.
    2. Depends. You can't utilize the composite index if the searching condition is not whole or front part of the indexing key. You can't utilize your index if you query the table for y=2. That is.
    3. As old words in database arena, Index may be good or bad for a table depending on the size of table, number of columns in the table... etc. It is very environmental dependent. In fact, It is part of database nomalization. Statistic is a way oracle use to determine the execution plan.
    Steve
    null

  • Difference Between Unique Index vs Unique Constraint

    Can you tell me
    what is the Difference Between Unique Index vs Unique Constraint.
    and
    Difference Between Unique Index and bitmap index.
    Edited by: Nilesh Hole,Pune, India on Aug 22, 2009 10:33 AM

    Nilesh Hole,Pune, India wrote:
    Can you tell me
    what is the Difference Between Unique Index vs Unique Constraint.http://www.jlcomp.demon.co.uk/faq/uk_idx_con.html
    and
    Difference Between Unique Index and bitmap index.The documentation is your friend:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/schema.htm#CNCPT1157
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref1008
    Regards,
    Rob.

  • 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!"

  • Constraint table in sql server7

    i have a database in sql server7 and i want to see all the constraints that are applied on that table manually i.e. through sql query.please tell me what is the sql query that i can use to see all the constraints applied on the table.
    same thing i want to do with ms-access ,tell me if i can use any query to see the constraints on ms-access table.

    Hi, this is Oracle Forum, you must go to Microsoft Forum for add this Post, please take the next reference.
    http://forums.microsoft.com/
    Regards.

  • How to apply the constraint ONLY to new rows

    Hi, Gurus:
       I have one question as follows:
       We need to migrate a legacy system to a new production server. I am required to add two columns to every table in order to record who updates the row most recently through triggers, and  I should apply not null constraint to the columns . However, since legacy system already has data for every table, and old data does not have value for the 2 new columns. If we apply the constraint, all of existing rows will raise exception. I wonder if there is possibility to apply the constraint ONLY to new rows to come in future.
    Thanks.
    Sam

       We need to migrate a legacy system to a new production server. I am required to add two columns to every table in order to record who updates the row most recently through triggers, and  I should apply not null constraint to the columns .
    The best suggestion I can give you is that you make sure management documents the name of the person that came up with that hair-brained requirement so they can be sufficiently punished in the future for the tremendous waste of human and database resources they caused for which they got virtually NOTHING in return.
    I have seen many systems over the past 25+years that have added columns such as those: CREATED_DATE, CREATED_BY, MODIFIED_DATE, MODIFIED_BY.
    I have yet to see even ONE system where that information is actually useful for any real purpose. Many systems have application/schema users and those users can modify the data. Also, any DBA can modify the data and many of them can connect as the schema owner to do that.
    Many tables also get updated by other applications or bulk load processes and those processes use generic connections that can NOT be tied back to any particular system.
    The net result is that those columns will be populated by user names that are utterly useless for any auditing purposes.
    If a user is allowed to modify a table they are allowed to modify a table. If you want to track that you should implement a proper security strategy using Oracle's AUDIT functionality.
    Cluttering up ALL, or even many, of your tables with such columns is a TERRIBLE idea. Worse is adding triggers that server no other purpose but capture useless infomation but, because they are PL/SQL cause performance impacts just aggravates the total impact.
    It is certainly appropriate to be concerned about the security and auditability of your important data. But adding columns and triggers such as those proposed is NOT the proper solution to achieve that security.
    Before your organization makes such an idiotic decision you should propose that the same steps be taken before adding that functionality that you should take before the addition of ANY MAJOR structural or application changes:
    1. document the actual requirement
    2. document and justify the business reasons for that requirement
    3. perform testing that shows the impact of that requirement on the production system
    4. determine the resource cost (people, storage, etc) of implementing that requirement
    5. demonstrate how that information will actually be used EFFECTIVELY for some business purpose
    As regards items #1 and #2 above the requirement should be stated in terms of the PROBLEM to be solved, not some preconceived notion of the solution that should be used.
    Your org should also talk to other orgs or other depts in your same org that have used your proposed solution and find out how useful it has been for them. If you do this research you will likely find that it hasn't met their needs at all.
    And in your own org there are likely some applications with tables that already have such columns. Has anyone there EVER used those columns and found them invaluable for identifying and resolving any actual problem?
    If you can't use them and their data for some important process why add them to begin with?
    IMHO it is a total waste of time and resources to add such columns to ALL of your tables. Any such approach to auditing or security should, at most, be limited to those tables with key data that needs to be protected and only then when you cannot implement the proper 'best practices' auditing.
    A migration is difficult enough without adding useless additional requirements like those. You have FAR more important things you can do with the resources you have available:
    1. Capture ALL DDL for the existing system into a version control system
    2. Train your developers on using the version control system
    3. Determining the proper configuration of the new server and system. It is almost a CERTAINTY that settings will get changed and performance will suffer even though you don't think you have changed anything at all.
    4. Validating that the data has been migrated successfully. That can involve extensive querying and comparison to make sure data has not been altered during the migration. The process of validating a SINGLE TABLE is more difficult if the table structures are not the same. And they won't be if you add two columns to every table; every single query you do will have to specify the columns by name in order to EXCLUDE your two new columns.
    5. Validating the performance of the app on the new system. There WILL BE problems where things don't work like they used to. You need to find those problems and fix them
    6. Capturing the proper statistics after the data has been migrated and all of the indexes have been rebuilt.
    7. Capturing the new execution plans to use a a baseline for when things go wrong in the future.
    If it is worth doing it is worth doing right.

  • Null values v IOT with primary constraint

    Hi gurus.
    I've overheard boss' conversation with client, who complaints that one of the columns in a system IOT table with NOT NULL and PRIMARY KEY returns nulls.
    Do you have any ideas? I do not have access to this DB, I just wonder, how it could be and what are these points, that we should start with.
    Thank you in advance,
    Maria.

    ou, sorry if I was not so clear, but I'm absolutely calm and even more: it's not my responsibility at all to fix that problem :-))
    all that I wanted is just to find some weak places where the reason of the problem could exists and give it my boss while he is busy with his time consuming project (in short, i just wanted to help him to resolve it, not waiting while he will ask me to do that). nobody is in panic, everything is ok in a world.
    clear description:
    client has a system table (IOT) that sometimes returns null values from column with NOT NULL and PRIMARY KEY constraint. as I remember from school, it's impossible. client wonders if it's an Oracle 9i bug and upgrade to 10g will fix it, or it's a block corruption. I do't know the answer, that's why I'm asking you, Oracle's gurus.
    Thank you all,
    M.

  • Primary key and relevant not null check constraints....

    Hi ,
    There are some constraints of primary key type and not null check constraints on columns which constitute each primary key....
    Should I/Do I have to drop them....????
    Do they burden the db at the time of data validation....????
    Thanks...
    Sim

    Hi,
    >>There are some constraints of primary key type and not null check constraints on columns which constitute each primary key..
    In fact, a column that constitutes a primary key, by default cannot accept NULL values. In this case, defines a PK column as NOT NULL would not be necessary.
    LEGATTI@ORACLE10> create table x (id number constraint pk_x primary key);
    Table created.
    LEGATTI@ORACLE10> desc x
    Name                  Null?    Type
    ID                    NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='X';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION                
    PK_X                           P X
    LEGATTI@ORACLE10> create table y (id number not null constraint pk_y primary key);
    Table created.
    LEGATTI@ORACLE10> desc y
    Name                  Null?    Type
    ID                   NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Y';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION
    SYS_C006327381 C Y "ID" IS NOT NULL 
    PK_Y                           P Y
    LEGATTI@ORACLE10> alter table y drop constraint SYS_C006327381;
    Table altered.
    LEGATTI@ORACLE10> desc y
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> insert into y values (NULL);
    insert into y values (NULL)
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("LEGATTI"."Y"."ID")
    LEGATTI@ORACLE10> insert into y values (1);
    1 row created.
    LEGATTI@ORACLE10> insert into y values (1);
    insert into y values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (LEGATTI.PK_Y) violated
    >>Should I/Do I have to drop them....????
    I don't see any problem, otherwise, drop the NOT NULL constraint is the same with alter the column table like below:
    LEGATTI@ORACLE10> create table z (id number not null constraint pk_z primary key);
    Table created.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    SYS_C006328420 C Z "ID" IS NOT NULL
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> alter table z modify id NULL;
    Table altered.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBERCheers
    Legatti

  • NOT and NOT NULL constraints

    I saw this posted on Metalinks and the answer was to be found here. I can't seem to find it..... has there been a resolution to this? Unfortunately, I am running into the same problem.
    You help is appreciated.
    I am trying to create Oracle8i schema from MS SQL Sercer 7.0 using Oracle Migration Workbench and it is not functioning as expected.
    Problems are:
    =============
    1. If the column type is CHAR OR VARCHAR in MS SQL Server and the integrity contraints is NOT NULL or NULL, in Oracle8i it create as NULL only and it not taking the NOT NULL in MS SQL Server to Oracle8i NOT NULL. I can say that it is ignoring the integrity constraint for CHAR OR VARCHAR type while converting to Oracle8i.
    Example in MS SQL Server
    ========================
    CREATE TABLE emp (
    emp_name CHAR(10) NOT NULL
    the tool converts to Oracle8i as
    CREATE TABLE emp (
    emp_name CHAR(10)
    It is ignoring the NOT NULL constraints in Oracle8i and it is happening only for CHAR and VARCHAR data type. Can anyone help me on this how to rectify the problem in Migration Workbench. ....... "

    We reported this for the EA's, but got little response and obviously no resolution.
    K.

Maybe you are looking for

  • Converting Acrobat 7 SDK -built plug-in to Acrobat 9

    We have a plug-in developed inhouse with Acrobat 7 SDK. We are looking for someone with SDK programming experience to help us port it for Acrobat 9. We tried ourselves using Xcode compiler, but it seems that the plug-in is not showing up either as a

  • Keyboard no longer lights on Macbook Pro

    It was working fine, but now it just doesn't light at all.  I checked System Preferences but there was nothing for keyboard lights.  Is this a sign of a bigger issue?

  • How to display result of a query in browser?

    I have to write a simple application where I use EJB to access a database and then use Servlet/JSP to display the data to a browser. can anyone help me out please?

  • AI update failed

    Adobe Illustrator CS6 Update (version 16.0.3) Installation failed. Error Code: U44M1P7 Error message shown above. All other programs in CS6 updated.

  • Passing control in Smart forms

    Hi! Gurus, As i was working with EKKO and EKPO and displaying amount for each order. I wanted to display total amont due for all the open POs on page 1. hw can i pass control from page 3 to page 1. Regards, Digvijay