Procedure with cursor-like loop (simple)
SQL
Medium
2 views
Problem Description
Create sp_mark_low_stock(p_limit) that sets Products.low_stock=1 when qty_on_hand < p_limit.
Input Format
SQL procedure
Output Format
Procedure created
Sample Test Case
Input:
Products(qty_on_hand, low_stock)
Output:
Procedure created
Constraints
No cursor needed; set-based is fine
Official Solution
CREATE PROCEDURE sp_mark_low_stock(IN p_limit INT) BEGIN UPDATE Products SET low_stock = 1 WHERE qty_on_hand < p_limit; END;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!