Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to raise Exception in HSQLDB procedure or function

What I want to do is just raise a exception in HSQL 2.0.

As in Oracle we can use : .... EXCEPTION WHEN OTHERS THEN raise_application_error(XXX) ....

After read HSQL official documentation and tried what I can imagine , I still didn't get a clue.

Is there anybody can give a suggestion ? Thanks!

like image 397
Villim Avatar asked Oct 26 '22 03:10

Villim


1 Answers

See the SIGNAL statement in the Guide:

http://hsqldb.org/doc/2.0/guide/sqlroutines-chapt.html#src_psm_exceptions

Example:

SIGNAL SQLSTATE '45000';

HSQLDB follows the SQL Standard PSM syntax for procedures and functions. This syntax is also followed by DB2, therefore many DB2 examples can be used with HSQLDB.

like image 54
fredt Avatar answered Dec 05 '22 19:12

fredt