Files
BUT2/TP_BD/fichiereponsetp2.sql

15 lines
411 B
MySQL
Raw Permalink Normal View History

2025-11-27 13:53:52 +01:00
--1
CREATE SEQUENCE seq_tp
INCREMENT BY 1
START WITH 121;
BEGIN
--2
CREATE PROCEDURE sp_insert_ligne_commande(p_commande_id INT, p_produit_id INT,p_quantit number)
is v_prix_total NUMBER
BEGIN
SELECT p.prix_unitaire*lc.p_quantite into v_prix_total FROM Produit p, Ligne_commande lc WHERE p.id=p_produit_id
INSERT INTO Ligne_commande values (seq_t.NEXT, p_commande_id,
p_produit_id, p_quantite,v_prix_total)