Calling a user defined stored procedure from select statement mysql

前端 未结 1 2026
一向
一向 2021-01-04 00:59

I am trying to call a user defined stored procedure from a select statement and its giving me an error. However when I call a system procedure it works just fine. Is there a

相关标签:
1条回答
  • 2021-01-04 01:08

    You can call stored procedure from select statement,To call a procedure you must use following syntax:

    CALL stored_procedure_name (param1, param2, ....)  
    

    Such as, you can CALL following procedure:

    DELIMITER //
    
    CREATE PROCEDURE `procedure1`(IN var1 INT)
    BEGIN
        SELECT var1 + 2 AS result;
    END//
    

    as

    CALL procedure1(10);
    

    Check this site for reference: http://net.tutsplus.com/tutorials/an-introduction-to-stored-procedures/

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