Sim ja havia tentado assim, mas da erro
if exists(SELECT * from estoque where Produto_idProduto = 1 AND Validade = "2012-10-30") then
begin
UPDATE estoque SET Quantidade=50 Where Produto_idProduto = 1
end;
else
begin
INSERT INTO estoque(Produto_idProduto, Validade, Quantidade) VALUES (5,"2012-11-30",10)
end;
end if; ;
erro: Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘if exists(SELECT * from estoque where Produto_idProduto = 1 AND Validade = "2012’ at line 1
(0 ms taken)
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘else
begin
INSERT INTO estoque(Produto_idProduto, Validade, Quantida’ at line 1
(0 ms taken)
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘end if’ at line 1
(0 ms taken)
Nota to usando mysql 6,0