Oracle 23ai introduces the concept of Table Blockchain, which allows you to create and manage immutable tables. These tables are particularly useful in scenarios requiring a high level of data integrity and security, such as financial transactions, audits, and compliance logging. A blockchain table in Oracle 23ai ensures immutability once data is inserted, it cannot be deleted or modified without detection. The Oracle 23ai database has the capability to detect any attempt to tamper with the data in the table. Each row is hashed and the hash is stored in the row itself. Rows are cryptographically linked, forming a chain of data, similar to a blockchain.
In this blog I will show you how to use Table Blockchain in Oracle 23ai.
Prerequisites
1 You must have a 23ai pluggable database.
Steps
SQL> create blockchain table financial sales (order_num number, day date, cust_id number, movie_id number, title varchar(25))
NO DROP UNTIL 15 days IDLE
NO DELETE UNTIL 16 days AFTER INSERT
LOCKED HASHING USING "SHA2_512" version "v2";
SQL> insert into financial_sales values (00359, systimestamp, 5000, 9875, 'Avatar');
commit;
SQL> INSERT INTO oe.financial_sales VALUES (00123, systimestamp, 5000, 9875,'Top Gun2');
SQL> UPDATE oe.financial_sales SET cust_id=5001 WHERE order_num=00123;
SQL> DROP TABLE oe.financial_sales;