虽然结贴了,我也补充一下:
1.
这里字段不能设定序列为默认值。官网解释:
Restriction on Default Column Values , A DEFAULT expression cannot contain references to PL/SQL functions or to other columns, the pseudocolumns CURRVAL, NEXTVAL, LEVEL, PRIOR, and ROWNUM, or date constants that are not fully specified.
创建完之后,可以通过触发器在字段上使用序列。
2.
5楼的方法有个缺陷: 如果再往里插入数据的话,id还是没有值的,还要update一下。直接使用触发器,一次搞定。
希望对楼主有帮助。