Search code examples
mysqlsqlfunctionstandardsansi-sql

Does this function conform to ANSI SQL standard?


I was wondering if anyone can tell me if this function follows ANSI SQL standard, and for future reference are there any resources that i can use to find if my SQL conforms to ANSI standards. And the DBMS i am using is MySQL.

CREATE FUNCTION INCREMENT()
RETURNS INT
BEGIN
    DECLARE oldVal INT;
    DECLARE newVal INT;
    SELECT currentVal INTO oldVal FROM atable FOR UPDATE;
    SET newVal=oldVal +1;
    UPDATE atable SET currentVal=newVal;
    RETURN newVal;
END;

Solution

  • Found a validation tool that can check if your SQL conforms to SQL 2003.
    http://developer.mimer.com/validator/parser200x/index.tml