We have one requirement where different database sequences needs to be maintained for different channels. EX: ABC-SQN1, XYZ-1, and the Sequence nos needs to be incremented b
Your question is unclear. Please describe requirements more datailed. I understand you want to have a few sequences and increment them conditionally so:
create sequence chanel1_seq INCREMENT BY 1 START WITH 1;
create sequence chanel2_seq INCREMENT BY 1 START WITH 1;
create sequence chanel3_seq INCREMENT BY 1 START WITH 1;
and then access sequence set by function not directly:
create or replace function get_seq_val(chanell in varchar2) return varchar2 is
begin
if (chanell = 'CH1') then
return 'CH1' || chanel1_seq.nextval;
elsif (chanell = 'CH2') then
return 'CH2' || chanel2_seq.nextval;
elsif (chanell = 'CH3') then
return 'CH3' || chanel3_seq.nextval;
end if;
return '';
end;
And get value by:
select get_seq_val('CH1') from dual;