The parameter name of the MySQL stored procedure is not the same as the field name (Bloody cost)

Source: Internet
Author: User

Title, the result will be that the value of the parameter will not be the value you passed in, but the value of the field for each record.
The consequences of this are often severe. For example, to perform a delete operation, it can completely delete the entire table record.
This is my bloody price.

The dead pit is as follows, do not jump:

[SQL]View Plaincopy
    1. DELIMITER $$
    2. Use ' b10k ' $$
    3. DROP PROCEDURE IF EXISTS ' sp_delete_species ' $$
    4. CREATE definer= ' luth ' @ '% ' PROCEDURE ' sp_delete_species ' (
    5. in species_id INT,/* species id*/
    6. Out out_rows INT/* Number of affected rows * /
    7. )
    8. BEGIN
    9. DELETE from ' sample ' WHERE ' species_id ' = species_id;
    10. DELETE from ' filepath ' WHERE ' species_id ' = species_id;
    11. DELETE from ' species ' WHERE ' species_id ' = species_id;
    12. SET out_rows = Row_count ();
    13. end$$
    14. DELIMITER;

The parameter name of the MySQL stored procedure is not the same as the field name (Bloody cost)

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.