Mysql closes the order stored procedure application
This article mainly introduces the application of Mysql closed order stored procedure, hoping to supplement and update some knowledge for you. If you have any other questions you need to know, you can continue to follow my updated article in the industry information.
Close the order stored procedure
Begin
Declare done int default 0
Declare orderid varchar (22)
# declare the cursor that queries the order
Declare cur cursor for select orders.order_id from orders where orders.order_state = 'wait_pay'
# exception handling
Declare continue handler for sqlstate '02000' set done = 1
# Open the cursor
Open cur
# traversing data
Fetch next from cur into orderid
Repeat
If not done then
# query the order issuing time according to the order number
Select orders.order_xiatime into @ a from orders where order_id=orderid
# get the time after 1 day according to the time of placing the order (one day first, change it to 12 hours after normal use of the stored procedure)
SELECT ADDDATE (@ a, INTERVAL 24 Hour) into @ b
# judge whether the member has not done any processing within 1 day
If @ b