inventory_held_by_customer
Documentation | Sakila |
Name | inventory_held_by_customer |
Module | Functions |
The inventory_held_by_customer function returns the customer_id of the customer who has rented out the specified inventory item.
Input/Output
Mode | Name | Data type | Description | |
---|---|---|---|---|
1 | OUT | Returns | int(10, 0) | This function returns the customer_id of the customer who is currently renting the item, or NULL if the item is in stock. |
This function returns the customer_id of the customer who is currently renting the item, or NULL if the item is in stock. | ||||
2 | IN | p_inventory_id | int(10, 0) | The ID of the inventory item to be checked. |
The ID of the inventory item to be checked. |
Script
BEGIN DECLARE v_customer_id INT; DECLARE EXIT HANDLER FOR NOT FOUND RETURN NULL; SELECT customer_id INTO v_customer_id FROM rental WHERE return_date IS NULL AND inventory_id = p_inventory_id; RETURN v_customer_id; END |
Exported: 2018-10-12 17:43, Last imported: 2018-08-06 10:44