Create a function column that is the result of OR between 3 columns

computed-columnoracle

I have a table with 3 columns (A,B,C).

In each row, only one of the columns is not null.

How do I create a function column or a computed column that will consist from all the non null values?

Something like: column(A or B or C)

Best Answer

The syntax for virtual columns is very simple:

ALTER TABLE tableX
  ADD abc AS (COALESCE(a, b, c)) ;

Tested at rextester.com.