oracle Immutable Table - ghdrako/doc_snipets GitHub Wiki
Oracle Database 21c introduced the concept of immutable tables. Immutable tables are insert-only tables in which existing data cannot be changed. Deleting rows from the immutable table is prohibited unless the insert occurred more than the specified number of days ago. After creation, no DDL can be performed to alter the table’s layout. It is possible to add and remove constraints and indexes, however.
create immutable table dutchdrivers
( driverid number(11) not null
, driverref varchar2( 255 )
, driver_number number ( 11 )
, code varchar2( 3 )
, forename varchar2( 255 )
, surname varchar2( 255 )
, dob date
, nationality varchar2( 255 )
, url varchar2( 255 )
)
no drop until 0 days idle
no delete until 16 days after insert
/
This feature was introduced in Oracle Database 21c but backported to Oracle Database 19.11 This feature can be very useful when storing data that should not be tampered with, like contract data. If you want even more security than just making sure the records cannot be changed, you can use the blockchain table, where the records are chained together using a hashing algorithm.