Search code examples
hsqldb

Error Create Function HSQL


I have an error creating the following function in HSQL:

CREATE FUNCTION getmax ()
   RETURNS INT
   BEGIN ATOMIC
     DECLARE max_event INT;
     SET max_event = SELECT MAX(tabla_id) FROM tabla;
     RETURN max_event;
   END
$$

Error:

5608=42608 wrong or missing data impact clause in declaration

I have looked at the documentation of HSQL and other pages, I invested a great amount of time and I can not solve it.

I need your help please.


Solution

  • I have managed to solve it.

    Here is the answer, in case someone else needs it.

    CREATE FUNCTION getmax ()
       RETURNS INT
        READS SQL DATA
         RETURN (SELECT MAX(tabla_id) FROM tabla)
    $$