gpt4 book ai didi

oracle - 哪个 oracle 数据类型映射到 BIGINT?

转载 作者:行者123 更新时间:2023-12-04 17:49:07 27 4
gpt4 key购买 nike

SQL> CREATE TABLE Product (id NUMBER(19,0) NOT NULL, name VARCHAR2(10 CHAR) NOT NULL);

Table created.

SQL> desc Product;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER(19)
NAME NOT NULL VARCHAR2(10 CHAR)

类型 NUMBER(19,0) 变为 NUMBER(19)。

从 JDBC 中,id 类型 NUMBER(19) 被映射到 java.sql.Types.DECIMAL,而不是 java.sql.Types.BIGINT。映射到 jdbc BIGINT 的 oracle 数据库类型是什么?

最佳答案

8.3.7 BIGINT

The JDBC type BIGINT represents a 64-bit signed integer value between -9223372036854775808 and 9223372036854775807.

The corresponding SQL type BIGINT is a nonstandard extension to SQL. In practice the SQL BIGINT type is not yet currently implemented by any of the major databases, and we recommend that its use be avoided in code that is intended to be portable.

The recommended Java mapping for the BIGINT type is as a Java long. https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html



然而,并不完全确定关于没有以这种方式实现 BIGINT 的 RDBMS 的声明,MS SQL Server 文档指出:
Data type   Range   Storage
bigint -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807) 8 Bytes

https://docs.microsoft.com/en-us/sql/t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql

尽管 JDBC 映射是 LONG

关于oracle - 哪个 oracle 数据类型映射到 BIGINT?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46531694/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com