使用正则自动为建表sql添加Sequence
如下一段建表语句:
create table df_attention (
id INTEGER not null,
userId INTEGER,
authorId INTEGER,
updateDate DATE,
del CHAR(1) default '0' not null,
constraint PK_DF_ATTENTION primary key (id)
);
-----------------------------
查找的正则语句:create table (.+)
给该段建表语句生成相应的Sequence,注意使用 \1 来代表正则的第一个匹配项:
create sequence \1_seq INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE;\ncreate table \1 \(
----------------------------
效果:
create sequence df_act_attention_seq INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE;
create table df_act_attention (
id INTEGER not null,
userId INTEGER,
actId INTEGER,
del CHAR(1) default '0' not null,
updateDate DATE,
constraint PK_DF_ACT_ATTENTION primary key (id)
);