Untitled
unknown
plain_text
9 months ago
1.1 kB
3
Indexable
DELIMITER // CREATE PROCEDURE books_issue_register() BEGIN DECLARE v_issueid INTEGER; DECLARE v_doi DATE; DECLARE v_exp_dor DATE; DECLARE v_memberid INTEGER; DECLARE flag INTEGER DEFAULT 0; -- Declare the cursor to select the required data from the book_issue table DECLARE cur CURSOR FOR SELECT issue_id, date_of_issue, expected_date_of_return, mem_id FROM book_issue; -- Declare the handler for when no more rows are found DECLARE CONTINUE HANDLER FOR NOT FOUND SET flag = 1; -- Open the cursor OPEN cur; -- Loop to fetch data from the cursor get_list: LOOP FETCH cur INTO v_issueid, v_doi, v_exp_dor, v_memberid; -- Exit the loop when no more rows are available IF flag = 1 THEN LEAVE get_list; END IF; -- Display the fetched data as a formatted string SELECT CONCAT(v_issueid, ':', v_doi, ':', v_exp_dor, ':', v_memberid) AS register; END LOOP get_list; -- Close the cursor after the loop CLOSE cur; END // DELIMITER ;
Editor is loading...
Leave a Comment