create sequence bs_com_seq increment by 1 start with 1 minvalue 1 maxvalue 999999 cycle nocache order; select to_char(sysdate,'yyyymmdd')||lpad(bs_com_seq.nextval,6,'0') from dual