Two columns same value Inserted into the table using trigger or using with out trigger

Two columns same value Inserted into the table using trigger or using with out trigger


Two columns same  value Inserted into the table:
create table test3
( number1 number(6,2),
number2 number(6,2),
total number(6,2) generated always as (number1+0) );


---------------------------------------------------------------

Two columns same  value Inserted into the table using trigger 

create table test1
  (number1 decimal(6,2),
   number2 decimal(6,2),
   total decimal(6,2));

CREATE TRIGGER test1_bi
  BEFORE INSERT ON test1
  FOR EACH ROW
BEGIN
  IF :new.total is NULL THEN
    :NEW.TOTAL := :new.number1 ;
  END IF;
END test1_bi;

INSERT INTO test1(number1, number2) VALUES(1, 2);

SELECT * FROM test1;
*/