MySql Stored Procedure's parameter with the same name as affecting's column, is it possible?

后端 未结 1 877
闹比i
闹比i 2021-01-02 13:45

I have a sequence table with two columns, name, value, and I have a stored procedure for incrementing the value provided the name

DROP PROCEDURE IF EXISTS p_         


        
相关标签:
1条回答
  • 2021-01-02 14:20

    Yes, scope your table column by an alias.

    e.g.

    delimiter //
    create procedure foo( id int )
    begin
     select * from users u where u.id = id;
    end
    //
    
    call foo( 123 )
    

    returns user id = 123

    0 讨论(0)
提交回复
热议问题