Constraint trouble

I have disabled a foreign key constraint and deleted all parent records in table A. I tried to re-enable the constraint and PLSQL complained about children in table B missing parent records. I want to tie the orphaned child records in table B to newly created records in Table C via a separate column. Is there anything I can do to reactivate the FK short of deleting the child records?

You cannot have the same column constrained against two different tables, so you may be out of luck. However, if you need to constraint those orphans against a different column that will be null for the other records, you have two choices.
First, you could insert a dummy parent in the parent table and assign the current orphans to that dummy parent. The other option would be to enable the constraint with the novalidate option.
I assume you situation is something like this:
SQL> CREATE TABLE t (id NUMBER, descr VARCHAR2(10));
Table created.
SQL> CREATE TABLE t1 (t1_id NUMBER, t_id NUMBER, descr VARCHAR2(10));
Table created.
SQL> ALTER TABLE t1 ADD CONSTRAINT t1_t_fk
  2     FOREIGN KEY (t_id) REFERENCES t (id);
Table altered.
SQL> INSERT INTO t VALUES(1, 'One');
1 row created.
SQL> INSERT INTO t VALUES(2, 'Two');
1 row created.
SQL> INSERT INTO t VALUES(3, 'Three');
1 row created.
SQL> INSERT INTO t1 VALUES (1, 1, 'T1One');
1 row created.
SQL> INSERT INTO t1 VALUES (2, 2, 'T1Two');
1 row created.
SQL> INSERT INTO t1 VALUES (3, 3, 'T1Three');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> ALTER TABLE t1 DISABLE CONSTRAINT t1_t_fk;
Table altered.
SQL> DELETE FROM t WHERE id = 3;
1 row deleted.
SQL> COMMIT;
Commit complete.You are here now. Creating a "dummy" parent requires an insert into parent (t in my example) and and update to child (t1 in my example). The novalidate option would go lke:
SQL> ALTER TABLE t1 ENABLE NOVALIDATE CONSTRAINT t1_t_fk;
Table altered.
SQL> INSERT INTO t1 VALUES (4, 3, 'T13Again');
INSERT INTO t1 VALUES (4, 3, 'T13Again')
ERROR at line 1:
ORA-02291: integrity constraint (OPS$ORACLE.T1_T_FK) violated - parent key not foundSo you cannot enter new orphans, but the existing ones will be fine. You can even update them if neccessary:
SQL> UPDATE t1 SET descr = 'Will Fail'
  2  where t1_id = 3;
1 row updated.
SQL> COMMIT;
Commit complete.HTH
John

Similar Messages

  • SQL*Loader and integrity constraints

    I am running into trouble with integrity constraints in my SQL*Loader script runs. Should I be going up to unix and removing the constraints from sqlplus, then asking the wizard to reinstall them after the data load? Is this documented somewhere? I can't find it. Sorry for asking such a basic question.
    Thanks,
    Ann Cantelow

    Hi,
    Your approach is correct.
    Create tables first
    Move data via the scripts
    Create contraints, indexes, primary keys
    See the User Guide for the ORacle Migration Workbench http://otn.oracle.com/tech/migration/workbench
    Regards
    John

  • Trouble printing in Photoshop cs4 or lightroom 2

    Hello,
    I have a HP z3200 printer and I have successfully calibrated and profiled this paper but now I am having trouble printing. The profiling said he was successful and ready for use for applications to print, but when I use applications like Photoshop or Lightroom 2 in the print settings and try to choose the paper type under the Paper type/quality in the print dialog in Leopard mac, the settings is grayed out, and won't let me select it. THe loaded paper is right below and I have the source as Manual Feed. THe size im printing to is 13" x 19" and I have selected that size in the page setup, super b/a3 on sheet media. I am using the Epson Enhanced Matte 13" x 19".
    There are some errors in the Constraints & device status in the Paper type/quality section of the print settings; one says something like the selected paper type is not available in printer (which is like that because I cant select it because its grayed out) and also it says the paper size selected is too big for the loaded paper, which is says it's 12.94" x 19.01".
    Any idea what I'm doing wrong?
    Thanks!

    I finally figured it out. I did some googling and found that there is a problem with Leopard and how it communicates.
    Taken from HP's pdf:
    "Why is the paper preset that I have just created grayed-out in my Mac driver?
    In Mac OS X v10.5, when you try to select the paper preset that you have just created in your paper type list on the driver, it might be grayed-out. This is a problem of interaction between the color settings and the paper types in this operating system version. Just select Any in the paper type list of the driver, and the printer will work with the paper preset that you have selected in the front panel of your printer. "

  • I am having trouble Trouble implementing one-way SSL on WebLogic 9.2...

    I am having trouble Trouble implementing one-way SSL on WebLogic 9.2. I am using Demo Identity and Demo Trust certificates with a SSL Listen Port Enabled on 7002, and a Two Way Client Cert Behavior of Client Certs Not Requested. I assume that by using Client Certs Not Requested that there is no need to install certificates on user's computers.
    When weblogic is restarted, I get the following log telling me it works...
    <Sep 11, 2012 9:35:16 AM PDT> <Notice> <Security> <BEA-090171> <Loading the identity certificate and private key stored under the alias DemoIdentity from the jks keystore file E:\bea\WEBLOG~1\server\lib\DemoIdentity.jks.>
    <Sep 11, 2012 9:35:17 AM PDT> <Notice> <Security> <BEA-090169> <Loading trusted certificates from the jks keystore file E:\bea\WEBLOG~1\server\lib\DemoTrust.jks.>
    <Sep 11, 2012 9:35:17 AM PDT> <Notice> <Security> <BEA-090169> <Loading trusted certificates from the jks keystore file e:\bea\jdk150_12\jre\lib\security\cacerts.>
    <Sep 11, 2012 9:35:17 AM PDT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 10.9.20.172:7000 for protocols iiop, t3, ldap, http.>
    <Sep 11, 2012 9:35:17 AM PDT> <Notice> <Server> <BEA-002613> <Channel "DefaultSecure" is now listening on 10.9.20.172:7002 for protocols iiops, t3s, ldaps, https.>
    However, when I open the console in https://server:7002/console, I get the following error in log file...
    <Sep 11, 2012 9:43:45 AM PDT> <Warning> <Security> <BEA-090481> <NO_CERTIFICATE alert was received from x.y.z.com - 10.37.10.54. Verify the SSL configuration has a proper SSL certificate chain and private key specified.>
    <Sep 11, 2012 9:43:45 AM PDT> <Warning> <Security> <BEA-090508> <Certificate chain received from x.y.z.com - 10.37.10.54 was incomplete.>
    I do not understand why I am getting this error when I assume there is no need to install certificates on user's computers. Can't someone please explain what is going on? Thanks in advance.

    <?xml version='1.0' encoding='UTF-8'?>
    <domain xmlns="http://www.bea.com/ns/weblogic/920/domain" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/security/extension http://www.bea.com/ns/weblogic/90/security.xsd http://www.bea.com/ns/weblogic/90/security/xacml http://www.bea.com/ns/weblogic/90/security/xacml.xsd http://www.bea.com/ns/weblogic/90/security http://www.bea.com/ns/weblogic/90/security.xsd http://www.bea.com/ns/weblogic/920/domain http://www.bea.com/ns/weblogic/920/domain.xsd http://www.bea.com/ns/weblogic/90/security/wls http://www.bea.com/ns/weblogic/90/security/wls.xsd">
    <name>nctcis</name>
    <domain-version>9.2.3.0</domain-version>
    <security-configuration>
    <name>nctcis</name>
    <realm>
    <sec:authentication-provider xsi:type="wls:default-authenticatorType">
    <sec:name>DefaultAuthenticator</sec:name>
    <sec:control-flag>SUFFICIENT</sec:control-flag>
    </sec:authentication-provider>
    <sec:authentication-provider xsi:type="wls:default-identity-asserterType">
    <sec:name>DefaultIdentityAsserter</sec:name>
    <sec:active-type>AuthenticatedUser</sec:active-type>
    </sec:authentication-provider>
    <sec:role-mapper xmlns:xac="http://www.bea.com/ns/weblogic/90/security/xacml" xsi:type="xac:xacml-role-mapperType"></sec:role-mapper>
    <sec:authorizer xmlns:xac="http://www.bea.com/ns/weblogic/90/security/xacml" xsi:type="xac:xacml-authorizerType"></sec:authorizer>
    <sec:adjudicator xsi:type="wls:default-adjudicatorType"></sec:adjudicator>
    <sec:credential-mapper xsi:type="wls:default-credential-mapperType"></sec:credential-mapper>
    <sec:cert-path-provider xsi:type="wls:web-logic-cert-path-providerType"></sec:cert-path-provider>
    <sec:cert-path-builder>WebLogicCertPathProvider</sec:cert-path-builder>
    <sec:name>myrealm</sec:name>
    </realm>
    <default-realm>myrealm</default-realm>
    <anonymous-admin-lookup-enabled>true</anonymous-admin-lookup-enabled>
    <credential-encrypted>{3DES}PyUkjWRp8JGpk75BYSbvQ6OWYgA9SZq2nj2IuENa2vxrMy835GMRZ+GGKhJiWapjt0mMC2ohcxxlIMNUZJUH2gCjbB5kQUmA</credential-encrypted>
    <node-manager-username>system</node-manager-username>
    <node-manager-password-encrypted>{3DES}KmaZDZGQC6spYVY12CbJGA==</node-manager-password-encrypted>
    </security-configuration>
    <jta>
    <timeout-seconds>1800</timeout-seconds>
    <abandon-timeout-seconds>3600</abandon-timeout-seconds>
    <max-transactions>100000</max-transactions>
    <max-resource-unavailable-millis>100000</max-resource-unavailable-millis>
    </jta>
    <log>
    <name>nctcis</name>
    <file-name>e:/netcracker/logs/wl-domain.log</file-name>
    <file-min-size>5120</file-min-size>
    </log>
    <server>
    <name>nctcisAdmin</name>
    <ssl>
    <enabled>true</enabled>
    <hostname-verifier xsi:nil="true"></hostname-verifier>
    <hostname-verification-ignored>false</hostname-verification-ignored>
    <client-certificate-enforced>true</client-certificate-enforced>
    <two-way-ssl-enabled>false</two-way-ssl-enabled>
    <server-private-key-alias>tcisdevbpagov_cert</server-private-key-alias>
    <server-private-key-pass-phrase-encrypted>{3DES}T21dXO5l79SRI+xSmGOE+A==</server-private-key-pass-phrase-encrypted>
    <use-server-certs>false</use-server-certs>
    </ssl>
    <log>
    <name>nctcisAdmin</name>
    <file-name>e:/netcracker/logs/weblogic.log</file-name>
    <file-min-size>5120</file-min-size>
    </log>
    <listen-port>7000</listen-port>
    <web-server>
    <name>nctcisAdmin</name>
    <web-server-log>
    <name>nctcisAdmin</name>
    <file-name>e:/netcracker/logs/access.log</file-name>
    <file-min-size>5120</file-min-size>
    </web-server-log>
    </web-server>
    <listen-address>tcis.dev.bpa.gov</listen-address>
    <key-stores>DemoIdentityAndDemoTrust</key-stores>
    <custom-identity-key-store-file-name>E:\bea\jdk150_12\bin\tcisdevbpagov_identity.jks</custom-identity-key-store-file-name>
    <custom-identity-key-store-type>JKS</custom-identity-key-store-type>
    <custom-identity-key-store-pass-phrase-encrypted>{3DES}T21dXO5l79SRI+xSmGOE+A==</custom-identity-key-store-pass-phrase-encrypted>
    <custom-trust-key-store-file-name>E:\bea\jdk150_12\bin\tcisdevbpagov_trust.jks</custom-trust-key-store-file-name>
    <custom-trust-key-store-type>JKS</custom-trust-key-store-type>
    <custom-trust-key-store-pass-phrase-encrypted>{3DES}I++r0/FEMRGFrqF47pYZJA==</custom-trust-key-store-pass-phrase-encrypted>
    </server>
    <embedded-ldap>
    <name>nctcis</name>
    <credential-encrypted>{3DES}i51JYfmoGyFTxPjiCjjtXWwza1t13k56Ls7fmdqtKB0=</credential-encrypted>
    </embedded-ldap>
    <configuration-version>9.2.3.0</configuration-version>
    <app-deployment>
    <name>NetCracker</name>
    <target>nctcisAdmin</target>
    <module-type>ear</module-type>
    <source-path>applications\NetCracker</source-path>
    <security-dd-model>DDOnly</security-dd-model>
    <staging-mode>nostage</staging-mode>
    </app-deployment>
    <app-deployment>
    <name>pictures</name>
    <target>nctcisAdmin</target>
    <module-type>war</module-type>
    <source-path>e:\pictures</source-path>
    <security-dd-model>DDOnly</security-dd-model>
    <staging-mode>nostage</staging-mode>
    </app-deployment>
    <jms-server>
    <name>NCJMSServer</name>
    <target>nctcisAdmin</target>
    <temporary-template-resource>NCJMSModule</temporary-template-resource>
    <temporary-template-name>NetCrackerTemplate</temporary-template-name>
    <message-buffer-size>100000</message-buffer-size>
    </jms-server>
    <self-tuning>
    <max-threads-constraint>
    <name>MaxThreadsConstraint</name>
    <target>nctcisAdmin</target>
    <count>40</count>
    </max-threads-constraint>
    <work-manager>
    <name>default</name>
    <target>nctcisAdmin</target>
    <max-threads-constraint>MaxThreadsConstraint</max-threads-constraint>
    <work-manager-shutdown-trigger>
    <stuck-thread-count>1000</stuck-thread-count>
    </work-manager-shutdown-trigger>
    </work-manager>
    </self-tuning>
    <jms-system-resource>
    <name>NCJMSModule</name>
    <target>nctcisAdmin</target>
    <sub-deployment>
    <name>BEA_JMS_MODULE_SUBDEPLOYMENT_NCJMSServer</name>
    <target>NCJMSServer</target>
    </sub-deployment>
    <descriptor-file-name>jms/ncjmsmodule-jms.xml</descriptor-file-name>
    </jms-system-resource>
    <admin-server-name>nctcisAdmin</admin-server-name>
    <jdbc-system-resource>
    <name>NetCrackerDataSource</name>
    <target>nctcisAdmin</target>
    <descriptor-file-name>jdbc/NetCrackerDataSource-5713-jdbc.xml</descriptor-file-name>
    </jdbc-system-resource>
    <jdbc-system-resource>
    <name>NetCrackerDataSourceNonTX</name>
    <target>nctcisAdmin</target>
    <descriptor-file-name>jdbc/NetCrackerDataSourceNonTX-6926-jdbc.xml</descriptor-file-name>
    </jdbc-system-resource>
    </domain>
    Edited by: user6904153 on Sep 12, 2012 6:57 AM

  • Implementing a Constraint Satisfaction Problem?

    Good afternoon,
    I'm having a lot of troubles implementing a Constraint Satisfaction Problem that requires the implementation of a restriction solver of finite domains (integers) under a java language.
    The system must allow:
    - Create restricted variables giving the domain limits with the class name "Variable".
         .Ex:
    Variable X = new Variable(1,10);
    Variable Y = new Variable(7,10);
    - Create the restrictions on the variables. The restrictions must by defined on the class "Constraint", the following restrictions shall be defined on the corresponding subclasses.
    The restrictions should always involve just two variables. The restrictions X=/Y, X=Y+C (C is a constant), X=Y, X>Y and X>=Y using the classes NEQ, NEPlus, EQ, GT and GE must be implemented.
         .Ex:
    Constraint c1 = new NEQ(X,Y);
    Constraint c2 = new NEPlus(X,Y,2);
    -One iterator named "VarIterator" which allows iterate under the variables of the iterator and obtain solutions.It must contain the methods start() and next() to initialize the iterator and obtain the solutions.
    .Ex:
    VarIterator it=new VarIterator(X);
    it.addVariable(Y);
    it.start();
    PS: I'm very thankful in advance to anyone who can help with this, i'm having problems just to start this and it's a assignment that i would like very much to succeed.

    _fwank_ wrote:
    The objective of my post wasn't to someone make the "homework", but to get any kind of help that could direct me to some kind of way to at least start the work.Then logically you should have asked a specific question or two, not just dumped your homework assignment here and saying vague things like "having a lot of troubles doing this", don't you think? What you posted obviously amounts to, in summary: "Please do my homework for me!"

  • Problem in enabling constraint - after disabling and truncation of table .

    Hello Friends,
    I have a table called DRR_TABLES that has list of table names . The requirement is to truncate the tables present in DRR_TABLES except KEY_IDS table and table_name like '%TYPE%' table.
    written a procedure . successfullly truncating the tables from DRR_TABLES but while enabling constraints after truncation , I am getting problem in enabling constraints .
    ERROR at line 1:
    ORA-02270: no matching unique or primary key for this column-list
    ORA-06512: at "schema123.TRUNCATE_DRR_TABLES ", line 49
    ORA-06512: at line 1
    Heres is the code .
    PROCEDURE TRUNCATE_DRR_TABLES is
    x varchar2(200);
    v_tablecount number := 0;
    cursor c is select TABLE_NAME from DRR_TABLES where population_source='PUBLISHING' and TABLE_NAME != 'KEY_IDS' and TABLE_NAME NOT LIKE '%TYPE%';
    BEGIN
    DBMS_OUTPUT.PUT_LINE (' TRUNCATING DRR TABLES ...........');
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c1 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status ='ENABLED' ORDER BY CONSTRAINT_TYPE DESC )
    loop
    begin
    execute immediate ('alter table '||c1.table_name||' disable constraint '||c1.constraint_name|| ' cascade');
    NULL;
    end;
    end loop;
    EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || x ;
    v_tablecount := v_tablecount + 1 ;
    DBMS_OUTPUT.PUT_LINE('TABLE TRUNCATED :'|| x );
    END LOOP ;
    DBMS_OUTPUT.PUT_LINE (' TOTAL TABLES TRUNCATED ' || v_tablecount );
    CLOSE c;
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c2 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status = 'DISABLED' ORDER BY CONSTRAINT_TYPE)
    loop
    begin
    execute immediate ('alter table '||c2.table_name||' enable constraint '||c2.constraint_name);
    NULL;
    end;
    end loop;
    END LOOP ;
    CLOSE c ;
    END TRUNCATE_DRR_TABLES ;
    LINE 49 is the line corresponding to enable constraint statement.
    Edited by: kumar73 on 3 Sep, 2012 11:44 PM

    It is such a pity that a user having 321 posts till date is unaware of basics of Posting a Question.
    1. You need to provide us with your Oracle version
    select * from v$version;2. You need to understand and get accustomed to using tags before and after Code or SQL's for better readability.
    3. You need to provide us with the Table Structure and the Constraints Definition.
    There are many things that looks like Bad Coding practices:
    <font face="Times New Roman" size=2>
    1. Avoid RBAR (Loops).
    2. Implement Bulk Collect.
    3. Why do you need to disable the constraints before truncating? Are you kind of handling the Referential Integrity Constraints?
    4. Duplicate checking of Disabled Constraints.
    5. When the procedure is being executed at Production Environment, are you going to Monitor the DBMS_OUTPUT? Why not Log the Statements into a LOG Table?
    6. Why use a TableCount variable? Would the TableCount Variable be not equal to the Number of Records returned by Cursor C?
    7. What is the need to use a NULL statement after every Execute Immediate?
    8. What is the Need to surround each execute Immediate with Begin .. End block?
    9. Where is your Exception handling Block? Forgot to write?
    </font>
    What has been your effort in finding which Constraint/Table is causing you the trouble?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Trouble with Materialized View

    Hello,
    I'm in need of some help enforcing data integrity using a materialized view. In my example, each system may consist of three types of components and this is modeled using supertype/subtype relationships. I'm trying to enforce that, for a given system, a component cannot reside in more than one component table. For example, given System 1, if Component A exists in the mobile_components table, it cannot be inserted into the desktop_components table for System 1. Rather than using triggers, I'm attempting to use a materialized view with unique constraint to enforce this rule based on the example from Tom Kyte's "The Trouble With Triggers" article http://www.oracle.com/technetwork/issue-archive/2008/08-sep/o58asktom-101055.html. However, I can't seem to get it to work as it gives me ORA-12054: Cannot set the ON COMMIT refresh attribute.  I'm using UNION ALL, and I know that can be tricky, but I can't figure out what rules I'm breaking.  I have the necessary privileges.  Oracle 11g.  Can anyone help?
    Thanks,
    Mark
    create table systems (
    sys_id number,
    sys_name varchar2(100),
    constraint sys_pk primary key (sys_id),
    constraint sys_uk unique (sys_name));
    insert into systems values (1,'System 1');
    insert into systems values (2,'System 2');
    create table mobile_components (
    mo_comp_id number,
    mo_comp_name varchar2(100),
    mo_comp_sys_id number,
    constraint mo_pk primary key (mo_comp_id),
    constraint mo_uk unique (mo_comp_name, mo_comp_sys_id),
    constraint mo_fk foreign key (mo_comp_sys_id) references systems (sys_id));
    insert into mobile_components values (1,'Component A',1);
    insert into mobile_components values (2,'Component A',2);
    create table desktop_components (
    de_comp_id number,
    de_comp_name varchar2(100),
    de_comp_sys_id number,
    constraint de_pk primary key (de_comp_id),
    constraint de_uk unique (de_comp_name, de_comp_sys_id),
    constraint de_fk foreign key (de_comp_sys_id) references systems (sys_id));
    insert into desktop_components values (1,'Component B',1);
    insert into desktop_components values (2,'Component B',2);
    create table internet_components (
    in_comp_id number,
    in_comp_name varchar2(100),
    in_comp_sys_id number,
    constraint in_pk primary key (in_comp_id),
    constraint in_uk unique (in_comp_name, in_comp_sys_id),
    constraint in_fk foreign key (in_comp_sys_id_ references systems (sys_id));
    insert into internet_components values (1,'Component C',1);
    insert into internet_components values (2,'Component C',2);
    create materialized view log on mobile_components with rowid;
    create materialized view log on desktop_components with rowid;
    create materialized view log on internet_components with rowid;
    create materialized view mv_components
    refresh fast on commit with rowid as
    select rowid as row_id, mo_comp_id as comp_id, mo_comp_name as comp_name
    from mobile_components
    union all
    select rowid, de_comp_id, de_comp_name
    from desktop_components
    union all
    select rowid, in_comp_id, in_comp_name
    from internet_components;
    alter table mv_components add constraint mv_comp_uk unique (comp_id, comp_name);

    You need a marker column to distinguish which of your queries you union, that data came from:
    e.g.
    create materialized view mv_components 
    refresh fast on commit with rowid as 
    select 'a' marker,rowid as row_id, mo_comp_id as comp_id, mo_comp_name as comp_name 
    from mobile_components 
    union all 
    select 'b',rowid, de_comp_id, de_comp_name 
    from desktop_components 
    union all 
    select 'c', rowid, in_comp_id, in_comp_name 
    from internet_components;

  • Database Constraint Error Handling on create/edit (Struts ADF)

    Hi,
    In our project we use Struts ADF (JDeveloper 10.1.3) technology. And we're facing the following trouble with it.
    If we try to create a record that violates say Unique constraint in the database, then during commit procedure of the AppModule's Transaction an exception occurs.
    We handle this exception with our extension of DCErrorHandlerImpl. And we have to do the rollback action because the Transaction became invalid and we cannot do the commit since there was an error.
    But unfortunately appModule.getTransaction().rollback(); forces ViewObj to loose all of the newly created rows. Because of this, after pressing submit with the same (violating) data once more our edit form shows the first row in a rowset.
    Are there any ideas about what we may be doing wrong?
    Any standard approaches on database constraint error handling?
    The "before/after commit/rollback" approach is very effort-consuming because we have a lot of views in our app and tracking all of them may become a nightmare in future.
    Thanks in advance.
    Regards,
    Larry

    Hi Steve!
    I'm using Postgree.
    Here is StackTrace
    06/06/27 09:52:24 Commit
    oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Insert": SQL Statement "INSERT INTO public.test_tb(id,name,org_code) VALUES (?,?,?)".
         at oracle.jbo.server.BaseSQLBuilderImpl.doEntityDML(BaseSQLBuilderImpl.java:481)
         at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5731)
         at com.yukon.adf.postgre.entities.PostgreEntityImpl.doDML(PostgreEntityImpl.java:22)
         at com.yukon.adf.postgre.entities.PostgreSequenceEntityImpl.doDML(PostgreSequenceEntityImpl.java:58)
         at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4531)
         at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2993)
         at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2804)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1968)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2170)
         at view.actions.ListTestPageController.onCommit(ListTestPageController.java:32)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at oracle.adf.controller.v2.lifecycle.PageController.invokeEventMethod(PageController.java:110)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.handleEvent(PageLifecycleImpl.java:950)
         at oracle.adf.controller.v2.struts.lifecycle.StrutsPageLifecycle.handleEvent(StrutsPageLifecycle.java:238)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.processComponentEvents(PageLifecycleImpl.java:322)
         at oracle.adf.controller.v2.lifecycle.PageController.processComponentEvents(PageController.java:54)
         at oracle.adf.controller.v2.lifecycle.Lifecycle$3.execute(Lifecycle.java:275)
         at oracle.adf.controller.v2.lifecycle.Lifecycle.executePhase(Lifecycle.java:116)
         at oracle.adf.controller.v2.lifecycle.LifecycleProcessor.execute(LifecycleProcessor.java:100)
         at oracle.adf.controller.v2.struts.actions.DataAction.execute(DataAction.java:123)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:629)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    ## Detail 0 ##
    java.sql.SQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
         at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
         at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
         at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
         at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
         at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
         at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
         at oracle.jbo.server.BaseSQLBuilderImpl.doEntityDML(BaseSQLBuilderImpl.java:352)
         at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5731)
         at com.yukon.adf.postgre.entities.PostgreEntityImpl.doDML(PostgreEntityImpl.java:22)
         at com.yukon.adf.postgre.entities.PostgreSequenceEntityImpl.doDML(PostgreSequenceEntityImpl.java:58)
         at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4531)
         at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2993)
         at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2804)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1968)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2170)
         at view.actions.ListTestPageController.onCommit(ListTestPageController.java:32)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at oracle.adf.controller.v2.lifecycle.PageController.invokeEventMethod(PageController.java:110)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.handleEvent(PageLifecycleImpl.java:950)
         at oracle.adf.controller.v2.struts.lifecycle.StrutsPageLifecycle.handleEvent(StrutsPageLifecycle.java:238)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.processComponentEvents(PageLifecycleImpl.java:322)
         at oracle.adf.controller.v2.lifecycle.PageController.processComponentEvents(PageController.java:54)
         at oracle.adf.controller.v2.lifecycle.Lifecycle$3.execute(Lifecycle.java:275)
         at oracle.adf.controller.v2.lifecycle.Lifecycle.executePhase(Lifecycle.java:116)
         at oracle.adf.controller.v2.lifecycle.LifecycleProcessor.execute(LifecycleProcessor.java:100)
         at oracle.adf.controller.v2.struts.actions.DataAction.execute(DataAction.java:123)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:629)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)

  • Create table - constraints

    Dear all,
    I have some tables and I need to create them but I cannot. Need help
    Create table address (
    some column name
    CONSTRAINT IXADDRE0 PRIMARY KEY (ID),
    FOREIGN KEY (FK_ADDRESS_TYPE)
    REFERENCES ADDRESS_TYPE (CODE),
    FOREIGN KEY (FK_COUNTRY)
    REFERENCES COUNTRY (ISO_CODE),
    FOREIGN KEY (FK_RELATION)
    REFERENCES RELATION (NUMBER0)
    ON DELETE CASCADE
    Can I create this table is the way mentioned below.
    Create table address (
    some column name
    CONSTRAINT IXADDRE0 PRIMARY KEY (ID)
    alter table address add (
    FOREIGN KEY (FK_ADDRESS_TYPE)
    REFERENCES ADDRESS_TYPE (CODE),
    FOREIGN KEY (FK_COUNTRY)
    REFERENCES COUNTRY (ISO_CODE),
    FOREIGN KEY (FK_RELATION)
    REFERENCES RELATION (NUMBER0)
    ON DELETE CASCADE
    waiting for answer.
    Thanks
    SL
    sorry for the trouble. I have done it.
    Message was edited by:
    user480060

    Have you tried the Oracle SQLReference_ guide? It has the complete syntax, including diagrams and examples.

  • Free Constraint Programming Library for Java?? what to use?

    Hi everyone,
    I am currently programming the popular Sudoku game as my final year project at university. After doing some research I found that using Constraint Programming would be the best way to generate and solve the Sudoku puzzles... however, I'm in a bit of a dilemma....
    I'm not sure what Constraint Library to use - the most popular one out there is Koalog - but its a commercial application - and I was looking for an open source or free application.
    I have been looking into the Choco (http://choco.sourceforge.net) Library but I am having trouble with getting hold of the global constraints I need ie AllDifferent.
    An extensive guide of how to use Constraint Programming is shown on the Java Sun Website: http://today.java.net/pub/a/today/2005/11/29/solving-sudokus-in-java.html
    Any advise would be greatly appreciated.
    Thanks in advance
    :o)

    Hi aniseed,
    Thanks for the user guide link -- I have looked through and I am beginning to understand it all.... but my main problem is that the user guide specifies a global constraint called allDifferent
    Here are described som of those constraints :
    1. pb.allDifferent(IntVar[] vars) creates a constraint ensuring that all pairs of variable
    have distinct values (which is useful for some matching problems)When I try to type pb.allDifferent into my program - it does not recognise the method so it does not compile- all the other methods work apart from this one.
    Any ideas?? :o)

  • Imposing a check constraint between 0 - 20

    I am having some trouble imposing a range check constraint on TOTALNOMS, I want for this number to be within 0 - 20. What is the SQL please?
    SQL> DESC MOVIE;
    Name Null? Type
    MOVIEID NOT NULL CHAR(3)
    TITLE CHAR(36)
    YEAR NUMBER
    COMPANY CHAR(50)
    TOTALNOMS NUMBER
    AWARDSWON NUMBER
    DVDPRICE NUMBER(5,2)
    DISCOUNTPRICE NUMBER(5,2)

    http://www.morganslibrary.org/library.html
    Scroll down to "Check Constraints" there are a lot of working demos.

  • IMAP error:  failed: Constraint violation

    Sun Java(tm) System Messaging Server 6.3-1.04 (built May 9 2007; 32bit)
    Has anyone seen these errors in their IMAP log?
    I have seen several periods where these crop up combined with an inability for user to login via imap or http.
    Logically something is happening at the DS end of things to cause this though I have yet to pinpoint it and b/c the directory logs do not show any clear
    evidence of bind failures that correspond to the imap log entries it has me puzzled.
    [25/Aug/2007:04:02:11 -0700] mina imapd[8231]: Account Warning: [128.111.207.54:34317] ldap bind (uid=help,ou=People,o=education.ucsb.edu) failed: Constraint violation

    Thanks Shane
    >
    When do these periods occur (busy times etc.) and for
    how long? Oddly, I saw this happen for an hour starting at 3AM (not a busy time with my users) Logs show another single user occasion happening in the PM at 16:00, but only for a few minutes.
    >
    Do you have to change anything (e.g. restart IMAP/DS
    server, reset passwords) to get things to work
    again?In the case of the hr long event I first restarted the DS which did not appear to fix the problem. I then restarted the msg-instance. The problem did not immediately clear up but did so shortly after.
    Are all users affected for a period of time or just
    some users. Any pattern?In the case of the long event I tested a variety of logins, which failed, and the logs showed that a variety of users could not login. There did not seem to be a pattern and as far as ican see all users were failing to login.
    >
    >
    Do the LDAP logs show any bind attempt or any
    communication at all related to the user(s) in
    question. Are there any errors in the LDAP error
    log(s)?I have not been able to definetevely correlate any errors in the LDAP logs at the time. However as far as I could see (with my account) I was binding OK at the time ( eg err=0) though I was not authing per the msg serv.
    >
    What version of DS are you running and do you use SSL
    between the MS server and DS server?5.2 sp2, No SSL is used between the DS and msg-serv
    >
    Are you running any kind of load-balancer/directory
    proxy etc. between messaging server and the directory
    server?NO
    >
    Are you using account lockout/password expiry?YES, a lockout after 6 failed tries.
    >
    Do you see any err=49 or err=19 log lines around the
    trouble periods?Yes, I see err=19 for the whole hr period in question as well as some err=49, though I do also see err=49 for other times but no err=19 at other times.
    >
    >>
    There haven't been any reported cases of this
    particular error in the IMAP logs but most constraint
    violation problems revolve around either SSL issues
    or account lockout problems. So more investigation
    needed at your end.Ok I will log all this info and am logically thinking that if this IS an account lockout issue it seems to point to an automated DS attack of some sort ?
    >
    >
    -john

  • Constraints and Full Screen

    Hi!
    I'm having some trouble with the full screen mode in Adobe
    AIR.
    I'm using constraints on a Canvas (centered and on the
    bottom). When I switch to full screen using hardware acceleration
    (fullScreenSourceRect) the position of the canvas is not updated
    and the canvas is lying behind the borders of the screen. Also the
    toolTips are not displayed correctly. I have an image at the top
    left corner (positioned by hand without constraints). The toolTip
    is shown outside the screen (to the right) and not to the left
    inside the viewable area.
    When I do the same in an application designed to run in a
    browser everything works fine. The canvas is positioned correctly
    and the tooltip is placed correctly.
    Any solution for this problem? Can this be a bug or did I
    miss any setting?
    Thank you very much in advance.

    I also have an issue that arises only in the air runtime for
    Windows. The exact same swf run fine on mac. When you enter in full
    screen (stage.displayState =
    StageDisplayState.FULL_SCREEN_INTERACTIVE;) any buttons lose their
    mouse-over display state. The buttons do answer to a click event
    but the rendering associated with roll over seem to be frozen.
    Again this happens on Windows only.
    Here is the sample app (mxml):
    <?xml version="1.0"?>
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    backgroundAlpha="0"
    usePreloader="false"
    creationComplete="onCreationComplete()">
    <mx:Script>
    <![CDATA[
    import flash.display.StageDisplayState;
    import flash.events.Event;
    import flash.utils.getQualifiedClassName;
    public function onCreationComplete():void
    trace("onCreationComplete " + getQualifiedClassName(this));
    public function goFullScreen():void
    trace("goFullScreen");
    stage.displayState =
    StageDisplayState.FULL_SCREEN_INTERACTIVE;
    public function goNormal():void
    trace("goNormal");
    stage.displayState = StageDisplayState.NORMAL;
    ]]>
    </mx:Script>
    <mx:Button click="goFullScreen()" label="go full screen"
    id="buttonFS"></mx:Button>
    <mx:Button click="goNormal()" label="go normal"
    id="buttonNormal"></mx:Button>
    </mx:WindowedApplication>

  • AMT enrollment error - Violation of UNIQUE KEY constraint 'EN_EnrollmentRecords_AK'.

    Hello,
    I've trouble enrolling AMT computer with SCCM 2012
    I've foud the following error in Amtproxymgr.log
    15/05/2014 14:54:50     
    Found instruction file: D:\Apps\Microsoft Configuration Manager\inboxes\amtproxymgr.box\{C6B0AAB5-BB02-4673-B44A-118917419389}.OTP
    15/05/2014 14:54:50     
    It's client provisioning request to be processed.
    15/05/2014 14:54:50     
    Stored provisioning request into database. SMSID: Machine_GUID
    15/05/2014 14:54:50     
    Target machine SMSID:Machine_GUID is a AMT capable machine.
    15/05/2014 14:54:50     
    Passed SanityCheckBeforeProvision(). FQDN is MYCOMPUTERNAME.domain.
    15/05/2014 14:54:50     
    BASE64 string OTP is : OTP_STRING
    15/05/2014 14:54:58      *** EN_EnrollmentAdminInsert @ProfileId = '16777217', @AssignedSiteCode = N'SITE_CODE', @DeviceName = N'MYCOMPUTERNAME', @ResourceID = '16816953', @OwnerIdentity = N'', @ClientType
    = '1', @OrganizationUnit = N'LDAP://OU=OU_NAME
    15/05/2014 14:54:58     
    *** [23000][2627][Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of UNIQUE KEY constraint 'EN_EnrollmentRecords_AK'. Cannot insert duplicate key in object 'dbo.EN_EnrollmentRecords'. The duplicate key value is (MYCOMPUTERNAME). : EN_EnrollmentAdminInsert
    15/05/2014 14:54:58     
    Fail to insert Enrollment Record!
    15/05/2014 14:54:58     
    Error: Failed to create enrollment record.
    If I do a query on V_R_SYSTEM the resource ID for MYCOMPUTERNAME is 16816953.
    If I do a query on EN_EnrollmentRecords the Ressource Id associated  to
    MYCOMPUTERNAME is 16777351
    So there is already a record for MYCOMPUTERNAME in
    EN_EnrollmentRecords.
    I think the reason is that the computer resource has been removed from SCCM and then readded. The computer has now a new Ressource ID. But the deletion of the previous computer ID did not removed the record from
    EN_EnrollmentRecords.
    How can I solve this ?

    Open Sql Server Management Studio, and do the query below.
    select * from dbo.en_EnrollmentRecords where ResourceID ='16777351'
    delete from dbo.EN_EnrollmentRecords where ResourceID = '16777351'
    Delete the Device from console and AD and try provisioning again.
    Note: Please backup your Database before doing this modification. Modifying database will be at your own risk.
    Juke Chou
    TechNet Community Support

  • File naming constraints

    I have been looking in two manuals and in the online Knowledgebase for GoLive. There is lots of reference to illegal characters and to filename constraints. But nowhere is there a list of characters that may not be used in a filename.
    I assume certain characters to be illegal regardless of how one creates a Web site--that they are illegal for the Web altogether.
    What are those illegal characters? Thanks.

    Yep, using an ampersand is strongly discouraged. Not to say it absolutely won't work in a page name - in most cases the page would still load. The main problem is that the ampersand has special meaning in a URL (to separate name/value pairs in a query string, for instance). Example:
    www.example.com/mypage.html?color=blue&animal=hamster
    ...which would be used to pass variables named "color" and "animals" to a script with their respective values. Your F&TadPage1.html file should still load because it doesn't follow a ? character beginning a query string.
    So, like most special characters, not really a firm "rule", but something that could cause you trouble in the long run.

Maybe you are looking for