Description
The film_not_in_stock
stored procedure
determines whether there are any copies of a given film not in
stock (rented out) at a given store.
Parameters
p_film_id
: The ID of the film to be checked, from thefilm_id
column of thefilm
table.p_store_id
: The ID of the store to check for, from thestore_id
column of thestore
table.p_film_count
: AnOUT
parameter that returns a count of the copies of the film not in stock.
Return Values
This procedure produces a table of inventory ID numbers for
the copies of the film not in stock, and returns (in the
p_film_count
parameter) a count that
indicates the number of rows in that table.
Sample Usage
Press CTRL+C to copymysql> CALL film_not_in_stock(2,2,@count); +--------------+ | inventory_id | +--------------+ | 9 | +--------------+ 1 row in set (0.01 sec) Query OK, 1 row affected (0.01 sec) mysql> SELECT @count; +--------+ | @count | +--------+ | 1 | +--------+ 1 row in set (0.00 sec)