DELIMITER //
DROP PROCEDURE IF EXISTS insert_video;
CREATE PROCEDURE insert_video
(
IN p_title VARCHAR(255),
IN p_duration INT(11),
IN p_imageUrl VARCHAR(255),
IN p_enabled TINYINT(1),
IN p_playerType VARCHAR(15),
IN p_sourceUrl VARCHAR(255),
IN p_fragmentID VARCHAR(255),
IN p_sectionNid INT(11),
IN p_startTime INT(11)
)
COMMENT 'Stored procedure to add a record in the Video table'
BEGIN
INSERT INTO Video
(
title,
duration,
imageUrl,
enabled,
playerType,
sourceUrl,
fragmentID,
sectionNid,
startTime
)
VALUES
(
p_title,
p_duration,
p_imageUrl,
p_enabled,
p_playerType,
p_sourceUrl,
p_fragmentID,
p_sectionNid,
p_startTime
);
END
//DELIMITER;
List with the stored procedures in the database
USE waisda;
SHOW procedure STATUS;
Calling the stored procedure
/
IN p_title VARCHAR(255)
IN p_duration INT(11)
IN p_imageUrl VARCHAR(255)
IN p_enabled TINYINT(1)
IN p_playerType VARCHAR(15)
IN p_sourceUrl VARCHAR(255)
IN p_fragmentID VARCHAR(255)
IN p_sectionNid INT(11)
IN p_startTime INT(11)
/
CALL insert_video
(
'title',
'duration',
'imageURL',
'enabled',
'playerType',
'sourceURL',
'fragmentID',
'sectionNid',
'startTime'
);
Stored procedures
Add new entry for the Video table
USE waisda;
DELIMITER // DROP PROCEDURE IF EXISTS
insert_video
;CREATE PROCEDURE
insert_video
( IN p_title VARCHAR(255), IN p_duration INT(11), IN p_imageUrl VARCHAR(255), IN p_enabled TINYINT(1), IN p_playerType VARCHAR(15), IN p_sourceUrl VARCHAR(255), IN p_fragmentID VARCHAR(255), IN p_sectionNid INT(11), IN p_startTime INT(11) ) COMMENT 'Stored procedure to add a record in the Video table' BEGIN INSERT INTO Video ( title, duration, imageUrl, enabled, playerType, sourceUrl, fragmentID, sectionNid, startTime ) VALUES ( p_title, p_duration, p_imageUrl, p_enabled, p_playerType, p_sourceUrl, p_fragmentID, p_sectionNid, p_startTime ); END //DELIMITER;List with the stored procedures in the database
USE waisda;
SHOW procedure STATUS;
Calling the stored procedure
/ IN p_title VARCHAR(255) IN p_duration INT(11) IN p_imageUrl VARCHAR(255) IN p_enabled TINYINT(1) IN p_playerType VARCHAR(15) IN p_sourceUrl VARCHAR(255) IN p_fragmentID VARCHAR(255) IN p_sectionNid INT(11) IN p_startTime INT(11) / CALL insert_video ( 'title', 'duration', 'imageURL', 'enabled', 'playerType', 'sourceURL', 'fragmentID', 'sectionNid', 'startTime' );