Databases Reference
In-Depth Information
In step 5, we create a similar table, named LOANS_VC , to store loan data. In this table, the
GROSS_CAPITAL field is not stored in the table, but it's a virtual column, for which we provide
the expression to calculate.
By executing the tests that we executed in step 4 on the LOANS table , on the table LOANS_VC
in step 6 we obtain the results shown in the following screenshot:
In step 7, we drop the tables created in this recipe to clean up the database.
There's more...
In this recipe, we have seen virtual columns in action, a feature useful in many situations,
which allows us to have calculated fields whose values aren't stored in the database.
Our test has shown that using virtual columns leads to performance gain over a solution
based on a regular field populated with a trigger.
Also, there are some other considerations for triggers that relate to performance improvement.
Using WHEN and OF in trigger definition
We have defined our trigger using the following definition:
CREATE OR REPLACE TRIGGER TR_LOANS_INS
BEFORE UPDATE OR INSERT ON sh.LOANS
FOR EACH ROW
 
Search WWH ::




Custom Search