The Parameter Name of the mysql stored procedure should not be the same as the field name

Source: Internet
Author: User

The Parameter Name of the mysql stored procedure should not be the same as the field name. The result will be that the parameter value will not be the value you passed in, it is the value of the field in each record. Such consequences are often serious. For example, you can delete all the records of the entire table. This is my bloody price. Do not skip the following:

[SQL] DELIMITER $ USE 'b10k' $ DROP PROCEDURE IF EXISTS 'SP _ delete_species '$ CREATE DEFINER = 'luth' @ '% 'Procedure 'SP _ delete_species '( IN species_id INT, /* species ID */OUT out_rows INT/* affected rows */) begin delete from 'sample' WHERE 'species _ id' = species_id; delete from 'filepath' WHERE 'species _ id' = species_id; delete from 'species 'where 'species _ id' = species_id; SET out_rows = ROW_COUNT (); END $ DELIMITER;

 

Related Article

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.