5.4.2 inventory_held_by_customer 函数

inventory_held_by_customer 函数返回租赁指定库存项目的客户的 customer_id

参数
  • p_inventory_id: 要检查的库存项目的 ID。

返回值

此函数返回当前正在租赁该项目的客户的 customer_id,如果该项目有库存,则返回 NULL

使用示例
mysql> SELECT inventory_held_by_customer(8);
+-------------------------------+
| inventory_held_by_customer(8) |
+-------------------------------+
|                          NULL |
+-------------------------------+
1 row in set (0.00 sec)

mysql> SELECT inventory_held_by_customer(9);
+-------------------------------+
| inventory_held_by_customer(9) |
+-------------------------------+
|                           366 |
+-------------------------------+
1 row in set (0.00 sec)