Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TRIGGER compraVenda
- BEFORE INSERT ON Venda
- FOR EACH ROW
- BEGIN
- SELECT CASE
- WHEN ((SELECT COUNT(*) FROM
- LinhaCompra, Produto, LinhaVenda
- WHERE LinhaVenda.id = LinhaCompra.id
- AND LinhaCompra.quantidade >= LinhaVenda.quantidade) = 0)
- THEN RAISE(ABORT, 'Peça ou quantidade invalidos.')
- END;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement