Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

oracle sql add column auto generated value

create table t2( col_name varchar2(10) );

insert into t2(col_name) values('hsaJDadkD');

ALTER TABLE t2 ADD (col_name2 GENERATED ALWAYS AS (SUBSTR(col_name,-3))); --virtual column

Select * from T2;

COL_NAME   COL_NAME
---------- --------
hsaJDadkD  dkD
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #oracle #sql #add #column #auto #generated
ADD COMMENT
Topic
Name
5+9 =