48 lines
914 B
MySQL
48 lines
914 B
MySQL
|
CREATE PROCEDURE AjouterT_lieu
|
||
|
@ID_lieu int OUTPUT,
|
||
|
@L_nom text
|
||
|
AS
|
||
|
INSERT INTO T_lieu(L_nom)
|
||
|
VALUES(@L_nom)
|
||
|
SET @ID_lieu=@@IDENTITY
|
||
|
RETURN
|
||
|
GO
|
||
|
CREATE PROCEDURE ModifierT_lieu
|
||
|
@ID_lieu int,
|
||
|
@L_nom text
|
||
|
AS
|
||
|
IF(@ID_lieu IS NULL OR @ID_lieu=0)
|
||
|
RAISERROR('Identifiant requis !',16,1)
|
||
|
ELSE UPDATE T_lieu
|
||
|
SET L_nom=@L_nom
|
||
|
WHERE ID_lieu=@ID_lieu
|
||
|
RETURN
|
||
|
GO
|
||
|
CREATE PROCEDURE SelectionnerT_lieu
|
||
|
@Index VARCHAR(10)
|
||
|
AS
|
||
|
IF(@Index='L_nom') SELECT * FROM T_lieu ORDER BY L_nom
|
||
|
ELSE SELECT * FROM T_lieu ORDER BY ID_lieu
|
||
|
RETURN
|
||
|
GO
|
||
|
CREATE PROCEDURE SelectionnerT_lieu_ID
|
||
|
@ID_lieu int
|
||
|
AS
|
||
|
IF(@ID_lieu IS NULL)
|
||
|
RAISERROR('Identifiant requis !',16,1)
|
||
|
ELSE
|
||
|
SELECT ID_lieu,L_nom
|
||
|
FROM T_lieu
|
||
|
WHERE @ID_lieu=ID_lieu
|
||
|
RETURN
|
||
|
GO
|
||
|
CREATE PROCEDURE SupprimerT_lieu
|
||
|
@ID_lieu int
|
||
|
AS
|
||
|
IF(@ID_lieu IS NULL)
|
||
|
RAISERROR('Identifiant requis !',16,1)
|
||
|
ELSE
|
||
|
DELETE FROM T_lieu WHERE @ID_lieu=ID_lieu
|
||
|
RETURN
|
||
|
GO
|