📜  oracle sql 添加列自动生成的值 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:30.252000             🧑  作者: Mango

代码示例1
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