Benutzer-Werkzeuge

Webseiten-Werkzeuge


pc:sqltricks

SQL- Tricks

Schlüssel- Fehler

https://stackoverflow.com/questions/11879217/display-names-of-all-constraints-for-a-table-in-oracle-sql

Error Msg = ORA-02291: Integritäts-Constraint () verletzt - übergeordneter Schlüssel nicht gefunden:

SELECT *
  FROM user_cons_columns
 WHERE TABLE_NAME = '<your table name>';
SELECT *
  FROM user_constraints
 WHERE TABLE_NAME = '<your table name>'
   AND constraint_name = '<your constraint name>';

oder auch https://stackoverflow.com/questions/11868758/find-parent-key-in-a-constraint

For the parent table:

SELECT * FROM all_constraints 
         WHERE constraint_name IN (
               SELECT R_CONSTRAINT_NAME 
                 FROM all_constraints 
                WHERE constraint_name = 'ADS_JOB_FAMILIES_F03'); 

For the parent column:

SELECT * 
  FROM all_cons_columns 
 WHERE constraint_name IN (
       SELECT constraint_name 
         FROM all_constraints 
        WHERE constraint_name IN (
              SELECT R_CONSTRAINT_NAME 
                FROM all_constraints 
               WHERE constraint_name = 'ADS_JOB_FAMILIES_F03')); 
pc/sqltricks.txt · Zuletzt geändert: 2022/05/25 12:13 von admin