Urgent Check Constraint Error

hi
i have a check constraint on a table B mean Nvl(Quantity,0)>=0 but when i update a table from a trigger on insertion of another table A
with :New.Quantity -ive it gives check constraint error.
Please Note it does not turn the balance into negative for table B
second because im inserting in table A then :new.quantity reffers to table A values not the table B
why this constraint error appears.
any body suggest
thanks in advance

tĦ€ §µåдŋ wrote:
i have a check constraint on a table B mean Nvl(Quantity,0)>=0 but when i update a table from a trigger on insertion of another table A
with :New.Quantity -ive it gives check constraint error.
Please Note it does not turn the balance into negative for table B
second because im inserting in table A then :new.quantity reffers to table A values not the table B
why this constraint error appears.Not urgent at all.
So you have a constraint on table B and then a trigger on table A attempts to update table B with a negative quantity which violates the constraint and it throws a constraint error.
That sounds right to me. What's the problem?

Similar Messages

  • Displaying an error message  coused by check constraint

    Hi,
    I'm trying to replace oracle error message by my own message.
    Form report is throwing an expected error like :
    'Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-02290: check constraint ...'
    I used the plsql block to handle with that but it doesnt set the my message. After press a button the check constraint validate a date and if data are unexpected then throwing a error which i want to replace by my own.
    The process is listed below:
    DECLARE
    invalid_sql EXCEPTION;
    PRAGMA EXCEPTION_INIT (invalid_sql, -02290);
    page_error EXCEPTION;
    PRAGMA EXCEPTION_INIT (page_error, -20001);
    BEGIN
    :p12_error := NULL;
    EXCEPTION
    WHEN invalid_sql THEN
    :p12_error := 'In case of sql injection attack some of the statements were forbidden: INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE, EXECUTE';
    WHEN page_error THEN
    :P12_ERROR := 'Please contact your administrator !!!';
    WHEN OTHERS THEN
    :p12_error := SQLERRM;
    END;
    P12_ERROR -- hidden item
    Then i set the 'success message ' :
    &P12_ERROR.
    What is wrong that is not showing my message?It not recognoze Init pragma?.
    Please give my some points on it!
    Edited by: rafix on 2008-12-16 04:31

    I followed Denes Kubick' way on his blog http://htmldb.oracle.com/pls/otn/f?p=31517:185:17139524101939:::RP,::
    where he created process on SubmitThe process is a simple example of error handling in ApEx. It does inserting and at the
    same time it handels exceptions. If an exception occurs, it will use a hidden item on the
    page to store error messages. At the same time, the success message of that process
    (which is what you get after pressing the "Save" button) is &P185_ERROR. item.
    Returning to my previous post i got tabular form report where constraint makes error in case of writing 'insert, delete...' after save button where have been pressed. Pragma mechenism is trapping like you wrote exceptions.Ok.
    So what i need configure to associate that process to trapped error?
    Edited by: rafix on 2008-12-17 05:40

  • 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

  • Time Constraint Error when calling a Function module from Webdynpro ABAP

    Any help will be greatly appreciated - Thanks RM
    Time Constraint Error
    Information on where terminated
        Termination occurred in the ABAP program "SAPUP50R" - in
         "CHECK_TIME_CONSTRAINT_S1".
        The main program was "MP000000 ".
        In the source code you have the termination point in line 1069
        of the (Include) program "UP50RU01".
    Error occurred during batch input processing
    Source Code Extract
          l_is_inconsistent = 'X'.
        ENDIF.
      Check if there are inverted time periods.
        IF l_prelp_line-begda > l_prelp_line-endda.
          l_is_inconsistent = 'X'.
        ENDIF.
    Check if there are overlaps or gaps.
        IF NOT l_prelp_before IS INITIAL.
          l_date_difference = l_prelp_line-begda - l_prelp_before-endda.
          IF l_date_difference <> 1.
            l_is_inconsistent = 'X'.
          ENDIF.
        ENDIF.
        l_prelp_before = l_prelp_line.
      ENDLOOP.
      IF l_prelp_before-endda <> '99991231'.
        l_is_inconsistent = 'X'.
      ENDIF.
      IF l_is_inconsistent = 'X'.
        IF p_access_type = 'R'.
    490 Datenbankschiefstand Personalnummer & Infotyp &
          MESSAGE x490 WITH l_prelp_before-pernr l_prelp_before-infty.
        ELSE.
    491 Unzulässige Daten Personalnummer & Infotyp &
    Line 1069 Error occcurs >>>>  MESSAGE x491 WITH l_prelp_before-pernr l_prelp_before-infty.
        ENDIF.
      ENDIF.
    ENDFORM.                    " CHECK_TIME_CONSTRAINT_S1     "XYVN0352581
    *&      Form  clear_no_adapter_needed              new     "XREN844998
          text
    FORM clear_no_adapter_needed .
      CLEAR no_adapter_needed.
    ENDFORM.                    " clear_no_adapter_needed
    *&      Form  set_no_adapter_needed              new     "XREN844998
          text
    FORM set_no_adapter_needed .
      no_adapter_needed = 'X'.
    ENDFORM.                    " clear_no_adapter_needed

    Hi,
    Well, are you trying to do a batch input on infotype 0000? If yes you need to check that the proposed values respects the time constraint, meaning no gap, no overlaps and no inversions. Also fields SUBTY, OBJPS, SPRPS and SEQNR must remain initial when processing IT0000...
    Kr,
    Manu.

  • How can I capture and re-present Oracle contraint/check/DML errors?

    Hi,
    New to APEX, I have a Designer/Web-PLSQL background.
    In Designer I can define the messages that I want the user to see when check, constraint, etc. errors are generated by the application interaction with the database server (done through table API and the integration of the Designer generated screens).
    In APEX, these types of errors all seem to show the default 'ORA' style message on an error page. How can I change these to 'human-readable' messages?
    I'm obviously missing the trick that changes an ORA-0001 message referring to CUST_CODE_UK to something like 'This Code has already been assigned to another customer'? I want to use standard functionality, not really keen on creating my own DML packages for every table that needs to be accessed through a screen.

    user8038482 wrote:
    dear sir,
    i have windows 7 and install oracle 10g,developer suite 10g 32 bit working everything fine but any forms trying to open giving errors oracle form designer stopted working check online sulition can you help get and send the like of patch file so i can download even i am able to download the patch file pls help i will be grateful for the same.
    thanks you..
    As'salamualikum, m z Islam
    check this Oracle Forms Designer has stopped working/ How to apply Patchset 7047034 ?
    Hope this works..
    hamid
    Mark correct/helpful to help others to get right answer(s).*

  • Is it possible to create a dynamic(with a select) check constraint?

    create table a (col_to_be_coded_fora number);
    create table b (col_to_be_coded_forb number);
    create table c (col_name varchar2(20), col_code number, col_desc varchar2(20));
    insert into c values ('col_to_be_coded_fora', 1, 'active');
    insert into c values ('col_to_be_coded_fora', 2, 'de-active');
    insert into c values ('col_to_be_coded_fora', 3, 'pending');
    insert into c values ('col_to_be_coded_forb', 10, 'school');
    insert into c values ('col_to_be_coded_forb', 20, 'hospital');
    insert into a values ( 1); -- meaning 'active' for table a, column col_to_be_coded_fora, can go in
    insert into a values (10); -- meaning nothing for table a, column col_to_be_coded_fora, must give error
    insert into b values ( 1); -- meaning nothing for table b, column col_to_be_coded_forb, must give error
    insert into b values (10); -- meaning 'school' for table b, column col_to_be_coded_fora, can go in
    I know i can handle this problem with dividing table c into to tables and creating foreign key relationship.
    in this demo case i have only a and b, 2 tables but i want to encode thousands of tables with a table like c.
    &#304;s it possible to create a dynamic check constraint on a table which selects c table for the inputs that have permision?
    Or do i have to use after insert, update triggers on table a and b to ensure this functionality?
    Is there a smarter implementation for this need, may be a design change?
    Thank you,
    Kind regards.
    Tonguç

    Hi Tonguç,
    A small design change makes it possible to do this with simple foreign key constraints.
    I would do something like:
    ual303@ORKDEV01> CREATE TABLE c (
      2    col_name VARCHAR2(20),
      3     col_code NUMBER,
      4     col_desc VARCHAR2(20),
      5     PRIMARY KEY (col_name, col_code)
      6  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> CREATE TABLE a (
      2    col_to_be_coded_fora NUMBER PRIMARY KEY,
      3     col_name VARCHAR2(20) DEFAULT 'col_to_be_coded_fora' CHECK (col_name = 'col_to_be_coded_fora'),
      4     FOREIGN KEY (col_name, col_to_be_coded_fora) REFERENCES c
      5  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> CREATE TABLE b (
      2    col_to_be_coded_forb NUMBER PRIMARY KEY,
      3     col_name VARCHAR2(20) DEFAULT 'col_to_be_coded_forb' CHECK (col_name = 'col_to_be_coded_forb'),
      4     FOREIGN KEY (col_name, col_to_be_coded_forb) REFERENCES c
      5  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 1, 'active');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 2, 'de-active');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 3, 'pending');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_forb', 10, 'school');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_forb', 20, 'hospital');
    1 rij is aangemaakt.
    ual303@ORKDEV01> -- meaning 'active' for table a, column col_to_be_coded_fora, can go in
    ual303@ORKDEV01> insert into a(col_to_be_coded_fora) values ( 1);
    1 rij is aangemaakt.
    ual303@ORKDEV01> -- meaning nothing for table a, column col_to_be_coded_fora, must give error
    ual303@ORKDEV01> insert into a(col_to_be_coded_fora) values (10);
    insert into a(col_to_be_coded_fora) values (10)
    FOUT in regel 1:
    .ORA-02291: integrity constraint (UAL303.SYS_C0033537) violated - parent key not found
    ual303@ORKDEV01> -- meaning nothing for table b, column col_to_be_coded_forb, must give error
    ual303@ORKDEV01> insert into b(col_to_be_coded_forb) values ( 1);
    insert into b(col_to_be_coded_forb) values ( 1)
    FOUT in regel 1:
    .ORA-02291: integrity constraint (UAL303.SYS_C0033540) violated - parent key not found
    ual303@ORKDEV01> -- meaning 'school' for table b, column col_to_be_coded_fora, can go in
    ual303@ORKDEV01> insert into b(col_to_be_coded_forb) values (10);
    1 rij is aangemaakt.
    ual303@ORKDEV01>Cheers,
    Colin

  • Using a function in a check constraint

    Hi,
    I created a domain table(id, code, domain_code, description) and foreign keys to this table. To ensure that a valid domain is put in the column I created a function that returns a boolean and has two parameters (id and domain_code). It returns true if the id and domain belong together.
    I want to know if it is possible to create a check constraint which validates the data in the refering table with the data in the domain table.
    Does anyone know if this is possible? Or do I have to use a db-trigger?
    Regards,
    Romano

    It still sounds like all you need is a foreign key constraint. Please see the example below, based on your revised criteria.
    scott@ORA92> create table domain
      2    (id         number,
      3       code         number,
      4       domain_code number,
      5       constraint  domain_pk primary key (id),
      6       constraint  domain_uk unique (code, domain_code))
      7  /
    Table created.
    scott@ORA92> insert into domain values (1, 10, 2)
      2  /
    1 row created.
    scott@ORA92> create table domain_values_table
      2    (id         number,
      3       domain_code number,
      4       constraint domain_values_table_uk unique (id, domain_code))
      5  /
    Table created.
    scott@ORA92> insert into domain_values_table values (1, 2)
      2  /
    1 row created.
    scott@ORA92> commit
      2  /
    Commit complete.
    scott@ORA92> create table referring
      2    (id         number,
      3       domain_code number,
      4       status         number,
      5       constraint  referring_fk foreign key (status)
      6                references domain (id),
      7       constraint  referring_fk2 foreign key (id, domain_code)
      8                references domain_values_table (id, domain_code))
      9  /
    Table created.
    scott@ORA92> insert into referring values (1,  2, null)
      2  /
    1 row created.
    scott@ORA92> insert into referring values (3, 4, null)
      2  /
    insert into referring values (3, 4, null)
    ERROR at line 1:
    ORA-02291: integrity constraint (SCOTT.REFERRING_FK2) violated - parent key not found

  • MView refresh error on 10gR2..(unique constraint error)

    Hi. all.
    The database is 2-node RAC 10gR2 on SunOS.
    Today morining, I got the following error.
    EXEC dbms_refresh.refresh('"ODSFAB"."CURRENTWIP"');
    ORA-12008: error in materialized view refresh path
    ORA-00001: unique constraint (ODSFAB.CURRENTWIP_GLASS_IDX) violated
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2254
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2460
    ORA-06512: at "SYS.DBMS_IREFRESH", line 683
    ORA-06512: at "SYS.DBMS_REFRESH", line 195
    ORA-06512: at line 1
    I checked both the source and target table, but there is no unique-key confliction.
    The source table has no unique index, but the target table have one unique index
    for a business purpose.
    Finally, I dropped the miew log on a source table and mview , and recreated mview
    log and mview with the same unique constraint and the same data.
    I do not understand why I got "Unique constraint error".
    Any advice will be welcomed.
    Thanks in advance.
    Have a good day.
    Best Regards.
    Message was edited by:
    user507290

    Let us say column A is the unique key on target DB and exists in source DB.
    Now, on source DB,
    - Value 'X' is inserted in col A
    - Value "X" is again inserted in col A (or updated on colA)
    - Then one of these 2 rows is deleted
    Now, "if" Oracle applies all the transactions from the source to target in the
    same sequence as they occured, there is chance you can get unique error.you do
    But, if a full refresh, there won't be error.I would say that is a very plausible explanation. Somewhat difficult to verify, in the absence of low-level auditing on the source database.
    The situation as described is a bit yucky. Is there no way of putting a unique key on the table in the source database? If not, it seems to me that this scenario is bound to re-occur.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • How to identify the constraint error

    Hi friends, i got constraint error, like this
    {4,209,669     123112 09:27:44:Code :ORA-02290: check constraint (OPS$hgn.CS_MQ_BADNORETAIL_CT7) violated at nopMASTERat sub exec block in pop_je2acct_othr}
    How can i identify, the from which procedure or package its failing... kindly help me out ..
    thanks in adavance .

    This surely is not the default Oracle message. it would look like
    DECLARE
        n NUMBER;
    BEGIN
        n := 1/0;
    END;
    DECLARE
    ERROR at line 4:
    ORA-01476: divisor is equal to zero
    ORA-06512: at line 4or
    DECLARE
        n NUMBER;
    BEGIN
        n := 1/0;
    EXCEPTION
        WHEN OTHERS THEN
            dbms_output.put_line(
                 dbms_utility.format_error_stack()||CHR(10)||
                 dbms_utility.format_error_backtrace()
            RAISE;
    END;
    ORA-01476: divisor is equal to zero
    ORA-06512: at line 4So you have to look into your packages and find out how your log messages are built up.
    A hint might be nhpMASTERat and pop_je2acct_othr. You can search your code where these names occur:
    SELECT  owner
           ,name
           ,type
           ,line
           ,text
    FROM    sys.all_source
    WHERE   owner = user
    AND     (  INSTR(UPPER(text),UPPER('nhpMASTERat')) > 0
            OR INSTR(UPPER(text),UPPER('pop_je2acct_othr')) > 0
    ORDER BY owner
            ,name
            ,type
            ,lineMarcus

  • How to create this check constraint

    create table emplt
    ( emplt_pk number,
    indvl_pk number,
    start_dt date,
    end_dt date,
    lct_fl char(1),
    sup_fl char(1),
    br_pk number,
    nro_pk number,
    default_fl char(1) default 'N' );
    INSERT INTO emplt
    values(
    1001, 101, to_date('01-01-2005', 'MM-DD-YYYY' ), NULL, 'Y','N',123,NULL,NULL );
    INSERT INTO emplt
    values(
    1002, 101, to_date('02-01-2005', 'MM-DD-YYYY' ), NULL, 'Y','N',NULL,0001,NULL );
    INSERT INTO emplt
    values(
    1003, 102, to_date('02-01-2005', 'MM-DD-YYYY' ), NULL, 'Y','N',NULL,0001,NULL );
    Is it possible to create a check constraint on this table that enforces that for a given indvl_pk, br_pk and nro_pk
    there is only one row with dflt_fl = 'Y'?
    Thanks in advance!

    Say,
    SQL> create unique index empli_ui on emplt(case default_fl when 'Y' then indvl_pk end,
      2  case default_fl when 'Y' then br_pk end,
      3  case default_fl when 'Y' then nro_pk end
      4  )
      5  /
    &nbsp
    Index created.
    &nbsp
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(1,2,3,'J');
    &nbsp
    1 row created.
    &nbsp
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(1,2,3,'J');
    &nbsp
    1 row created.
    &nbsp
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(3,2,1,'A');
    &nbsp
    1 row created.
    &nbsp
    SQL>
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(3,2,1,'A');
    &nbsp
    1 row created.
    &nbsp
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(3,2,1,'Y');
    &nbsp
    1 row created.
    &nbsp
    SQL>
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(3,2,1,'Y');
    insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.EMPLI_UI) violated
    &nbsp
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(1,2,3,'Y');
    &nbsp
    1 row created.
    &nbsp
    SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
      2  values(1,2,3,'Y');
    insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.EMPLI_UI) violatedRgds.

  • Time Constraint Error when calling a Function Module

    Any help will be greatly appreciated - Thanks RM
    Time Constraint Error
    Information on where terminated
    Termination occurred in the ABAP program "SAPUP50R" - in
    "CHECK_TIME_CONSTRAINT_S1".
    The main program was "MP000000 ".
    In the source code you have the termination point in line 1069
    of the (Include) program "UP50RU01".
    Error occurred during batch input processing
    Source Code Extract
    l_is_inconsistent = 'X'.
    ENDIF.
    Check if there are inverted time periods.
    IF l_prelp_line-begda > l_prelp_line-endda.
    l_is_inconsistent = 'X'.
    ENDIF.
    Check if there are overlaps or gaps.
    IF NOT l_prelp_before IS INITIAL.
    l_date_difference = l_prelp_line-begda - l_prelp_before-endda.
    IF l_date_difference 1.
    l_is_inconsistent = 'X'.
    ENDIF.
    ENDIF.
    l_prelp_before = l_prelp_line.
    ENDLOOP.
    IF l_prelp_before-endda '99991231'.
    l_is_inconsistent = 'X'.
    ENDIF.
    IF l_is_inconsistent = 'X'.
    IF p_access_type = 'R'.
    490 Datenbankschiefstand Personalnummer & Infotyp &
    MESSAGE x490 WITH l_prelp_before-pernr l_prelp_before-infty.
    ELSE.
    491 Unzulässige Daten Personalnummer & Infotyp &
    Line 1069 Error occcurs >>>> MESSAGE x491 WITH l_prelp_before-pernr l_prelp_before-infty.
    ENDIF.
    ENDIF.
    ENDFORM. " CHECK_TIME_CONSTRAINT_S1 "XYVN0352581
    *& Form clear_no_adapter_needed new "XREN844998
    text
    FORM clear_no_adapter_needed .
    CLEAR no_adapter_needed.
    ENDFORM. " clear_no_adapter_needed
    *& Form set_no_adapter_needed new "XREN844998
    text
    FORM set_no_adapter_needed .
    no_adapter_needed = 'X'.
    ENDFORM. " clear_no_adapter_needed

    Hi,
    Well, are you trying to do a batch input on infotype 0000? If yes you need to check that the proposed values respects the time constraint, meaning no gap, no overlaps and no inversions. Also fields SUBTY, OBJPS, SPRPS and SEQNR must remain initial when processing IT0000...
    Kr,
    Manu.

  • Toplink 10.1.3.1 Unique Constraint error

    Hi All,
    I'm working with toplink 10.1.3.1 using JDeveloper 10.1.3.1.
    When I'm using the Sequence in the toplink work bench, I'm getting the unique constraint error.
    What i did was, I checked the "Use sequencing" check box and filled the sequence name , table name and field in the toplink workbench wizard.
    And I kept true for "Use Native Sequencing" in the sequence of login tab for sessions.xml default file. And checked the preallocation Size and set to the minimum value of the sequence. I didn't checked the "Table", "Name Field" and "Counter Field" check boxes.
    The sequence is getting incremented for every execution. Its not getting the actual sequence current value. I don't know whether the value is getting cached.
    for example if the actual sequence number in the database is 1740
    but when I am running the toplink query It is generating the sequence number like 1738 and it is giving the Unique constraint when I am clicking on the button for three times (ie 1739,1740,1741)it is inserting successfully into the database.
    But when I am running the application again then it is generating the sequence number as 1739 I am unable to understand where I am going wrong.
    If I test The sequence in SQL Work Sheet it was working fine.
    could anyone suggest me the correct way of using the sequence in the toplink workbench.
    the Sequence was created using JDeveloper wizard with Increment 1.
    Thanks in advance,
    regards,
    Satish Dasari.

    Hi,
    Satish,Thanks for your reply.
    Let me tell the scenario. I have two tables A and B. First I am inserting an event_no in table A. and after that I read the data from table A including event_no and I am going to insert it into table B. Rarely I am getting an exception like Unique constraint violation error.
    I kept native sequencing true,preallocation size 1, Min value=1, Max-value=9999999, increment by 1, cache size=10, Enabled refresh only if new version.
    What are all the values that i need to be changed in order to recover from this error. Our application is running in a load balancing environment.
    Note: I am not able to simulate this in my desktop environment.
    Regards,
    P.Prasanna.

  • Oracle check constraint bug ?

    Hi,
    This is an 'interesting' bug:
    create table mytable (
    id number,
    status number,
    constraint mytable_pk primary key (id)
    insert into mytable (id, status) values (1, 0);
    insert into mytable (id, status) values (2, -1);
    On XE (10.2.0.1) and 10.2.0.4:
    Following command gives the expected ORA-02293 error (using string values instead of numbers): alter table mytable add constraint mytable_status_chk check (status in ('0', '1'));
    BUT no error with the following command: alter table mytable add constraint mytable_status_chk check (status in ('-1', '0', '1'));
    On XE:
    The query select * from mytable where status=0 returns no records until the constraint is dropped again !
    Best regards,
    Serge
    Edited by: sergeko on Nov 19, 2010 11:19 AM
    Edited by: sergeko on Nov 19, 2010 11:21 AM

    I don't have access to any 10.x or XE currently and cannot reproduce on EE 9.2.0.9 or 11.1.0.6.
    It's possible that you're running into an optimizer issue with the constraint.
    This might be visible if you run an explain plan on the statement, get the execution plan via dbms_xplan.display and check the predicates section both with and without the constraint.
    I take it that you don't get the problem if you use a check constraint with numbers not strings.
    I wonder also whether it makes a difference if you declare status as not null.
    Edited by: DomBrooks on Nov 19, 2010 10:44 AM

  • How to Disable check constraint in cronacle

    Hi All,
    We found that one job failed in cronacle with the following error
    *ORA-20800: JCS-02138: problem with parameter "PRINT_BANNERPAGE"
    SAP recommended the soultion saying
    Disable the "Check Constraints" that are being used in the scripts currently in Cronacle or apply some patch.So we want to explore the first option i.e check constraint
    Can any one help me in Regarding the check constraints.
    Thanks in advance
    shylaja

    Hi,
    Scripts can have check constraints and reference contraints, you will find these under the script properties when you edit the script.
    I would set the constraint to optional, meaning that you still have the dropdown available but it no longer complains if it does not like the chosen value.
    Regards,
    Anton.

  • Problem in creating CHECK constraint

    While creating a table, i want to apply a CHECK constraint, that pension_amount should be in accordance of pension_code, i am getting error mentioned below.
    CREATE TABLE pension_amount_check
       pension_amount         NUMBER (4),
       pension_code   NUMBER (1),
       CONSTRAINT amount_chk CHECK
          (CASE
              WHEN pension_code = 1 THEN (pension_amount = 3000 OR pension_amount > 3000)
              WHEN pension_code = 2 THEN pension_amount = 1500
           end)
    ORA-00907: missing right parenthesisHow i can resolve this.

    CREATE TABLE pension_amount_check
       pension_amount         NUMBER (4),
       pension_code   NUMBER (1),
       CONSTRAINT amount_chk CHECK
             (pension_code = 1 AND pension_amount  >= 3000)
              OR
             (pension_code = 2 AND pension_amount  = 1500)
    )http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_constraints.htm#ADFNS282

Maybe you are looking for