make sequences in mysql



create table mysql_sequences(
seq_name varchar(10) not null,
seq_currval Bigint unsigned not null,
primary key (seq_name)
)engine=MyISAM;





DELIMITER ;;

CREATE FUNCTION nextval()
returns bigint unsigned
modifies sql data
sql security invoker
begin
insert into mysql_sequences
set seq_name='default', seq_currval=(@v_current_value:=1)
on duplicate key
update seq_currval=(@v_current_value:=seq_currval+1);

return @v_current_value;
end ;;

Comments

Popular posts from this blog

codefights smooth sailing ( CommonCharacterCount)

How to remove 8443 port in URL in tomcat