Hi,

H2 does support user defined functions, but they have to be written in
Java. See the documentation (Features / User-Defined Functions and Stored
Procedures) for details.

Regards,
Thomas


On Friday, August 30, 2013, Rajiv Perera wrote:

>
> On Thu, Aug 29, 2013 at 6:09 PM, Thomas Mueller <
> [email protected]> wrote:
>
>> create sequence abc
>
>
> Hi,
> Thanks FYI Thomas. But my questions  that I have a sequence which is
> called by a function in mysql.The database has a
> table called PK_SEQUENCE  where the function will insert one an integer to
> that table and select the last updated number and return in that function
> which is called by the java code.
>
> So what i want to know is how to convert the following function in to h2
> function.
>
> CREATE DEFINER=`root`@`localhost` FUNCTION `PK_SEQUENCE`() RETURNS int(11)
> BEGIN
> DECLARE sequence_val INTEGER;
>     insert into PK_SEQUENCE values (NULL);
>     SELECT LAST_INSERT_ID() INTO sequence_val;
>     -- delete from sequence;
>     return sequence_val;
> END
>
> in the java code i call the PK_SEQUENCE function which is not a problem.
>
>
> --
> Rajiv
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to