Remove table master (if it exists) from the database
drop table if exists master;
create a table named master, with one field named callno of type int
create table master( callno int );
insert one row into table master
insert into master set callno=1;
select the one row to demonstrate the existing data
select callno from master;
create a stored procedure called callnoincr that increments field callno and returns the value stored
drop function if exists callnoincr;
delimiter go
create function callnoincr() returns int deterministic
begin
declare n int default 0;
set n = (select callno from master);
update master set callno=n+1;
return (select callno from master);
end;
go
delimiter ;
demonstrate how to use the new stored procedure
select callnoincr();
If your table contains many such fields, you can modify the SP to require a parameter of the field name you want increment, and return the value of that field.
Good luck,
Barry.