Dear H2 support,

I'm totally new to stored procedures, but I would like to use one to
emulate the TRUNC function of Oracle.

However, when trying to create the example procedure of the H2
documentation, I get the following error:

-----------------input--------------------------------
CREATE ALIAS NEXT_PRIME AS $$
String nextPrime(String value) {
    return new BigInteger(value).nextProbablePrime().toString();
}
$$;

-----------------output-------------------------------
Syntax error in SQL statement CREATE ALIAS NEXT_PRIME AS[*]
String nextPrime(String value) {
    return new BigInteger(value).nextProbablePrime().toString();
}
   ; expected FOR; SQL statement:
CREATE ALIAS NEXT_PRIME AS $$
String nextPrime(String value) {
    return new BigInteger(value).nextProbablePrime().toString();
}
$$ [42001-79] 42001/42001 (Help)
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement CREATE
ALIAS NEXT_PRIME AS[*]
String nextPrime(String value) {
    return new BigInteger(value).nextProbablePrime().toString();
}
   ; expected FOR; SQL statement:
CREATE ALIAS NEXT_PRIME AS $$
String nextPrime(String value) {
    return new BigInteger(value).nextProbablePrime().toString();
}
$$ [42001-79]
    at org.h2.message.Message.getSQLException(Message.java:103)
    at org.h2.message.Message.getSQLException(Message.java:114)
    at org.h2.message.Message.getSyntaxError(Message.java:139)
    at org.h2.command.Parser.read(Parser.java:2489)
    at org.h2.command.Parser.parseCreateFunctionAlias(Parser.java:
3724)
    at org.h2.command.Parser.parseCreate(Parser.java:3414)
    at org.h2.command.Parser.parsePrepared(Parser.java:321)
    at org.h2.command.Parser.parse(Parser.java:288)
    at org.h2.command.Parser.parse(Parser.java:260)
    at org.h2.command.Parser.prepareCommand(Parser.java:232)
    at org.h2.engine.Session.prepareLocal(Session.java:285)
    at org.h2.engine.Session.prepareCommand(Session.java:246)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:
1063)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:151)
    at org.h2.server.web.WebThread.getResult(WebThread.java:1713)
    at org.h2.server.web.WebThread.query(WebThread.java:1276)
    at org.h2.server.web.WebThread.process(WebThread.java:443)
    at org.h2.server.web.WebThread.processRequest(WebThread.java:185)
    at org.h2.server.web.WebThread.process(WebThread.java:240)
    at org.h2.server.web.WebThread.run(WebThread.java:195)


Any idea of what I'm missing?

Many thanks in advance,

Gilles.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to