create procedure PGetMaxWaterNO()begin
if not exists (select * from MSTB_BATCH_WATER where date(WATER_DATE)=curdate())
begin
insert into MSTB_BATCH_WATER (WATER_DATE,WATER_NO) values(NOW(),1);
end;
else
begin
update MSTB_BATCH_WATER set WATER_NO = WATER_NO+1
where date(WATER_DATE)=curdate();
end;end;
if not exists (select * from MSTB_BATCH_WATER where date(WATER_DATE)=curdate())
begin
insert into MSTB_BATCH_WATER (WATER_DATE,WATER_NO) values(NOW(),1);
end;
else
begin
update MSTB_BATCH_WATER set WATER_NO = WATER_NO+1
where date(WATER_DATE)=curdate();
end;end;
insert into MSTB_BATCH_WATER (WATER_DATE,WATER_NO) values(NOW(),1);' at line 5
begin
if not exists (select * from MSTB_BATCH_WATER where date(WATER_DATE)=curdate()) then
begin
insert into MSTB_BATCH_WATER (WATER_DATE,WATER_NO) values(NOW(),1);
end;
else
begin
update MSTB_BATCH_WATER set WATER_NO = WATER_NO+1
where date(WATER_DATE)=curdate();
end;
end if;
end;