create sequence TRADE_NO_SEQ
minvalue 1
maxvalue 999999
start with 3618
increment by 1
cache 20
cycle;
create or replace function GET_TRADE_NO_FUN return varchar2 is
TRADE_NO varchar2(50);
seq_num VARCHAR2(10);
begin
select TRADE_NO_SEQ.Nextval into seq_num from DUAL;
if seq_num<=999999 THEN
TRADE_NO:=Trim(TO_CHAR(seq_num,'000000'));
end if;
select TO_CHAR(SYSDATE,'YYMMDD')||TRADE_NO into TRADE_NO from DUAL;
return TRADE_NO;
end;
minvalue 1
maxvalue 999999
start with 3618
increment by 1
cache 20
cycle;
create or replace function GET_TRADE_NO_FUN return varchar2 is
TRADE_NO varchar2(50);
seq_num VARCHAR2(10);
begin
select TRADE_NO_SEQ.Nextval into seq_num from DUAL;
if seq_num<=999999 THEN
TRADE_NO:=Trim(TO_CHAR(seq_num,'000000'));
end if;
select TO_CHAR(SYSDATE,'YYMMDD')||TRADE_NO into TRADE_NO from DUAL;
return TRADE_NO;
end;