Now I want to perform every insert inside a transaction which will rollback if error=1.
set @error=0;
insert into shift values
("c0001","k_tamiou4","2011-4-23 14:00:00", "2011-4-23 22:00:00");
delimiter $$;
if @error>0 then
rollback;
else
commit;
end if;
$$
I get an sql syntax error 1064 near "if @error>0 then".
I searched all over the internet but still can't deal with the problem.
I will appreciate it if you reply in the next 2-3 hours as the deadline for my project is tomorrow...


Sign In
Create Account


Back to top









