I have the following table, where I would like the value of hash_val to be generated from clob_val whether clob_val is inserted or updated.
Can this be done perhaps by making the column hash_val a virtual column? Or does this have to be done via a function and trigger.
I want to use something like the CRYPTO call below to generate the value for hash_val. In addition, I would like hash_val to be the primary KEY
Any examples setting up the virtual column if possible would be greatly appreciated. Thanks to all who answer.
CREATE table table_z(
seq_num integer GENERATED BY DEFAULT AS IDENTITY (START WITH 1) NOT NULL,
val NUMBER,
hash_val VARCHAR2(1000),
clob_val CLOB);
DBMS_CRYPTO.HASH (clob_val, 6 /*DBMS_CRYPTO.HASH_SH512*/ )