简体   繁体   English

HSQLDB中的Oracle NUMBER(精度,小数位数)

[英]Oracle NUMBER(precision,scale) in HSQLDB

In a unit test I am trying to generate a table in an in-mem HSQLDB, the table contains a column with the definition: @Column(name = "xxx", columnDefinition="NUMBER(10,0) default 0") . 在单元测试中,我试图在内存中的HSQLDB中生成一个表,该表包含一列,其定义为: @Column(name = "xxx", columnDefinition="NUMBER(10,0) default 0") NUMBER is not recognized by HSQLDB (version 2.3.3), so I have added a script running this statement first: CREATE TYPE NUMBER AS NUMERIC; HSQLDB(版本2.3.3)无法识别NUMBER,因此我添加了一个首先运行此语句的脚本: CREATE TYPE NUMBER AS NUMERIC; . Now it seems to recognize NUMBER, but I get the error unexpected token: ( instead. I cannot edit the column definition, so wow do I correctly map Oracle NUMBER(10,0) to NUMERIC ? If I remove the precision and scale from NUMBER it seems to work. 现在它似乎可以识别NUMBER,但是我得到了错误的unexpected token: (相反。我无法编辑列定义,所以哇,我可以正确地将Oracle NUMBER(10,0)映射到NUMERIC吗?如果我从NUMBER中删除精度和小数位数它似乎有效。

You do not need to define the NUMBER type, as it is supported by HSQLDB. 您不需要定义NUMBER类型,因为HSQLDB支持该类型。

HSQLDB supports Oracle syntax in one of its compatibility modes. HSQLDB以其兼容模式之一支持Oracle语法。 Run this statement to enable it: 运行以下语句将其启用:

SET DATABASE SQL SYNTAX ORA TRUE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检测Oracle数字数据类型的实际精度和小数位数 - Detect actual precision and scale for Oracle number data type 当UCanAccess加载数据库时,HSQLDB“精度或范围超出范围”错误 - HSQLDB “precision or scale out of range” error when UCanAccess loads database JOOQ Oracle 数字精度和 java 数字映射 - JOOQ Oracle Number precision and java number mapping Oracle DB使用JDBC返回负缩放和0精度 - Oracle DB returning negative scale and 0 precision using JDBC 如何将大数(精度19,小数位数2)四舍五入为整数? - How to round a big number (precision 19, scale 2) to whole integer? 通过Java API获得NUMBER列的小数位数和精度? - Get scale and precision of a NUMBER column through Java API? "BigDecimal,精度和规模" - BigDecimal, precision and scale 当 BigDecimal 已经在 DB (Oracle) 中设置时,为 BigDecimal 指定精度和小数位数是否有意义? - Does it make sense to specify precision and scale for BigDecimal when it has already set in DB (Oracle)? 结果集元数据为我提供了相同的 NUMBER 和 NUMBER(Precision,Scale) 列类型 - result set metadata giving me the same column type for both NUMBER and NUMBER(Precision,Scale) 如何通过JDBC获取Teradata数字类型的精度和小数位数 - How can I get precision and scale of Teradata's number type through JDBC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM