MySQL stored procedures

Source: Internet
Author: User

DROP PROCEDURE IF EXISTS schema_change; --If this stored procedure is present, delete
DELIMITER//--delimiter,//For Start, touch next//End
CREATE PROCEDURE Schema_change ()--Define stored procedure name
BEGIN
IF EXISTS (SELECT * FROM information_schema.columns WHERE table_name = ' busi_finance_details ' and column_name = ' Order_typ E ') then--Determine if the column name exists
--Financial Table modification Order_type field remarks--2017-6-20
ALTER TABLE ' busi_finance_details '
MODIFY COLUMN ' order_type ' tinyint (2) not NULL DEFAULT 0 COMMENT ' number Type 1 repair order 2 Purchase Order 3 return order 4 refill 5 Purchase Card 6 Car wash single 7 beauty single 8 Care order 90 Sell Order 10 Inventory single ' after ' Order_no ';
END IF;
end//--End

DELIMITER;
Call Schema_change (); --Call the stored procedure

MySQL stored procedures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.