select to_char(sysdate, 'yyyy-MM-dd') || '-' ||
lpad((nvl(max(to_number(substr(user_no, 12))), 0) + 1),3,'0')
from t_user
where instr(user_no, to_char(sysdate, 'yyyy-MM-dd')) > 0;
oracle插入某字段在数据库中的最大值+1
发表评论
select to_char(sysdate, 'yyyy-MM-dd') || '-' ||
lpad((nvl(max(to_number(substr(user_no, 12))), 0) + 1),3,'0')
from t_user
where instr(user_no, to_char(sysdate, 'yyyy-MM-dd')) > 0;