Search notes:

ORA-02266: unique/primary keys in table referenced by enabled foreign keys

create table tq84_range_partition (
  id     number       not null,
  id_ref number,
  txt    varchar2(10) not null,
  dt     date         not null,
  --
  constraint tq84_range_partition_pk primary key (id    ),
  constraint tq84_range_partition_fk foreign key (id_ref) references tq84_range_partition
)
partition by range (dt) (
  partition tq84_range_partition_2014 values less than (date '2015-01-01'),
  partition tq84_range_partition_2015 values less than (date '2016-01-01'),
  partition tq84_range_partition_2016 values less than (date '2017-01-01'),
  partition tq84_range_partition_2017 values less than (date '2018-01-01')
);


   insert into tq84_range_partition values (1, null, 'root', date '2014-08-28');
-- insert into tq84_range_partition values (2,    1, 'chld', date '2015-02-17');

-- ORA-02266: unique/primary keys in table referenced by enabled foreign keys
alter table tq84_range_partition drop partition tq84_range_partition_2014;

drop table tq84_range_partition purge;
Github repository Oracle-Patterns, path: /errors/ORA/02266_unique-primary-keys-in-table-referenced-by-enabled-foreign-keys/partition-in-hierarchical-table.sql

See also

Error messages related to referential integrity.
Foreign keys and primary keys.
Other Oracle error messages

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1740463613, '3.133.130.105', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/errors/ORA-02266_unique-primary-keys-in-table-referenced-by-enabled-foreign-keys(67): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78