Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql closes the order stored procedure application

Shulou Source: shulou.com Published: 2022-06-01 20:52:09 10月01日 Update

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

Tags: Orders processes storage time updates applications hours cursors questions queries answers specialties tasks members available in place multiple diva actual inventory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Xiaomi Redmi MySQL