I have following stored procedure. I expect the output with single record set which will have three columns (meeting_room_id, slot_id, min_booking_length) as parameters passed in stored procedure. Following stored procedure gives me record set from first select statement. How can I get intended output using this stored procedure?
CREATE PROCEDURE validate_meeting_room_booking_slot(
INOUT meeting_room_id BIGINT,
IN rent_space_start_time VARCHAR(255),
IN rent_space_end_time VARCHAR(255),
IN scheduled_date DATE,
OUT slot_id BIGINT,
OUT min_booking_length INT)
BEGIN
SELECT id INTO @slot_id
FROM meeting_room_booked_slots
WHERE meeting_room_id = meeting_room_id
AND date = scheduled_date
AND (
(start_time < rent_space_start_time
AND end_time > rent_space_start_time)
OR
(start_time >rent_space_start_time
AND start_time < rent_space_start_time))
LIMIT 1;
SELECT meeting_room_id, min_booking_length
FROM meeting_rooms
WHERE id = meeting_room_id
AND deleted_at IS NULL;
END