不能创建别名`if` if`或``ifnull''
如果,我正在尝试在H2Database中创建一个别名,并且我会收到以下错误。
org.h2.jdbc.JdbcSQLSyntaxErrorException: Function alias "IF" already exists; SQL statement:
CREATE ALIAS `IF` FOR "test.Udf.ifAlias" [90076-212]
然后,我尝试在创建之前将if
删除,然后收到以下错误。
org.h2.jdbc.JdbcSQLSyntaxErrorException: Function alias "IF" not found; SQL statement:
DROP ALIAS `IF` [90077-212]
IFNULL
发生了类似的情况。我正在初始脚本中尝试以下几行。
DROP ALIAS `IF`;
CREATE ALIAS `IF` FOR "test.Udf.ifAlias";
ifalias
的Java功能是
public static boolean ifAlias(boolean condition, boolean exp1, boolean exp2) {
if(condition) {
return exp1;
}
return exp2;
}
I am trying to create an alias in H2database for IF
and I get the following error.
org.h2.jdbc.JdbcSQLSyntaxErrorException: Function alias "IF" already exists; SQL statement:
CREATE ALIAS `IF` FOR "test.Udf.ifAlias" [90076-212]
Then I try to drop the IF
before creating, and I get the following error.
org.h2.jdbc.JdbcSQLSyntaxErrorException: Function alias "IF" not found; SQL statement:
DROP ALIAS `IF` [90077-212]
Similar happens for IFNULL
. I am trying the following lines in my init script.
DROP ALIAS `IF`;
CREATE ALIAS `IF` FOR "test.Udf.ifAlias";
And the Java function for the ifAlias
is
public static boolean ifAlias(boolean condition, boolean exp1, boolean exp2) {
if(condition) {
return exp1;
}
return exp2;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于版本1.4.198,如果是H2中的关键字。请参阅此问题和回答: https://github.com/h2database/h2database/h2database/h2database/3018 <3018 <3018 <3018 <3018 <3018 <3018 <3018 <3018 <3018 <3018 /a>
Since version 1.4.198, IF is a keyword in h2. See this issue and responses: https://github.com/h2database/h2database/issues/3018