I am using Oracle 11g express and SqlDeveloper 4.0.3.In my database i have a table called TABLE1 like this:
ID A B C
1 3 2 null
2 1 2 null
I also have a java program that inserts values on the table the ID,A,B. So i want the database to remember like a function to add column A and B and set it to C and not doing it manually like this on the Query on Developer : UPDATE TABLE1 SET C=A+B WHERE C IS NULL;
How can it be done?
My guess is that you want to drop the existing physical column C and to create a new virtual column C
ALTER TABLE table1
DROP COLUMN c;
ALTER TABLE table1
ADD c GENERATED ALWAYS AS (a+b);