You must Sign In to post a response.
  • Category: [Competition Entries]

    Error in Create Function In mySQL

    Hi ,

    Any one can you say the syntax for creating function in MYSQL?
  • #698209
    Please check the below Sample MySQL function


    DELIMITER $$

    DROP FUNCTION IF EXISTS 'AddValues'$$

    CREATE FUNCTION 'AddValues'
    (
    Val1 INT,
    Val2 INT
    )
    RETURNS INT
    DETERMINISTIC
    BEGIN
    RETURN Val1 + Val2
    END$$

    DELIMITER ;


    -- You can call use function like

    SELECT AddValues(10, 10);

    Please mark this as Answer, if this helps

    Regards,
    Alwyn Duraisingh.M 
    << Database Administrator >>
    Jesus saves! The rest of us better make backups...


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.