# Data Types

## Index

* [CHARACTER](#character)
* [CHARACTER VARYING](#character-varying)
* [CHARACTER LARGE OBJECT](#character-large-object)
* [VARCHAR\_IGNORECASE](#varchar_ignorecase)
* [BINARY](#binary)
* [BINARY VARYING](#binary-varying)
* [BINARY LARGE OBJECT](#binary-large-object)
* [BOOLEAN](#boolean)
* [TINYINT](#tinyint)
* [SMALLINT](#smallint)
* [INTEGER](#integer)
* [BIGINT](#bigint)
* [NUMERIC](#numeric)
* [REAL](#real)
* [DOUBLE PRECISION](#double-precision)
* [DECFLOAT](#decfloat)
* [DATE](#date)
* [TIME](#time)
* [TIME WITH TIME ZONE](#time-with-time-zone)
* [TIMESTAMP](#timestamp)
* [TIMESTAMP WITH TIME ZONE](#timestamp-with-time-zone)
* [JAVA\_OBJECT](#java_object)
* [ENUM](#enum)
* [GEOMETRY](#geometry)
* [JSON](#json)
* [UUID](#uuid)
* [ARRAY](#array)
* [ROW](#row)

## Details

### CHARACTER

{% hint style="info" %}
```
{ CHARACTER | CHAR | NATIONAL { CHARACTER | CHAR } | NCHAR }
[ ( lengthInt [CHARACTERS|OCTETS] ) ]
```
{% endhint %}

A Union String of fixed length.

Length, if any, should be specified in characters, **`CHARACTERS`** and **`OCTETS`** units have no effect in Guinsoo. The allowed length is from 1 to 1,000,000,000 characters. If length is not specified, 1 character is used by default.

The whole text is kept in memory when using this data type. For variable-length strings use **`CHARACTER VARYING`** data type instead. For large text data **`CHARACTER LARGE OBJECT`** should be used; see three for details.

Too short strings are right-padded with space characters. Too lang strings are truncated by **`CAST`** specification and rejected by column assignment.

Two CHARACTER strings of different lengths are considered equal if all additional characters in the longer string are space characters.

See also string literal grammar. Mapped to **`java.lang.String`**.

Example:

```
CHARACTER
CHAR(10)
```

### CHARACTER VARYING

{% hint style="info" %}
```
{ { CHARACTER | CHAR } VARYING
| VARCHAR
| { NATIONAL { CHARACTER | CHAR } | NCHAR } VARYING
| { VARCHAR_CASESENSITIVE } }
[ ( lengthInt [CHARACTERS|OCTETS] ) ]
```
{% endhint %}

A Unicode String. Use two single quotes ('') to create a quote.

The allowed length is from 1 to 1,000,000,000 characters. The length is a size constraint; only the actual data is persisted. Length, if any, should be specified in characters, **`CHARACTERS`** and **`OCTETS`** units have no effect in Guinsoo.

The whole text is loaded into memory when using this data type. For large text data **`CHARACTER LARGE OBJECT`** should be used; see there for details.

See also string literal grammar. Mapped to **`java.lang.String`**.

Example:

```
CHARACTER VARYING(10)
VARCHAR(255)
```

### CHARACTER LARGE OBJECT



### VARCHAR\_IGNORECASE



### BINARY



### BINARY VARYING



### BINARY LARGE OBJECT



### BOOLEAN

{% hint style="info" %}
<pre><code><strong>BOOLEAN
</strong></code></pre>
{% endhint %}

Possible values: TRUE, FALSE, and UNKNOWN (NULL).

See also boolean literal grammar. Mapped to **`java.lang.Boolean`**.

Example:

```
BOOLEAN
```

### TINYINT

{% hint style="info" %}
```
TINYINT
```
{% endhint %}

Possible values are -128 to 127.

See also integer literal grammar.

in **`JDBC`** this data type is mapped to **`java.lang.Integer`**. **`Java.lang.Byte`** is also supported.

Example:

```
TINYINT
```

### SMALLINT



### INTEGER



### BIGINT



### NUMERIC

{% hint style="info" %}
```
{ NUMERIC | DECIMAL | DEC } [ ( precisionInt [ , scaleInt ] ) ]
```
{% endhint %}

Data type with fixed decimal precision and scale. This data type is recommended for storing currency values.

If precision is specified, it must be from 1 to 100000. If scale is specified, it must be from 0 to 100000, 0 is the default.

See also numeric literal grammar. Mapped to **`java.math.BigDecimal`**.

Example:

```
NUMERIC(20, 2)
```

### REAL



### DOUBLE PRECISION



### DECFLOAT



### DATE

{% hint style="info" %}
```
DATE
```
{% endhint %}

The date data type. The proleptic Gregorian calendar is used.

See also date literal grammar.

In **`JDBC`** this data type is mapped to **`java.sql.Date`**, with the time set to **`00:00:00`** (or to the text possible time if midnight doesn't exist for the given date and time zone due to a daylight saving change). **`java.time.LocalDate`** is also supported and recommended.

In **`org.guinsoo.api.Aggregate`**, **`org.guinsoo.api.AggregateFunction`**, and **`org.guinsoo.api.Trigger`** this date type is mapped to **`java.time.LocalDate`**.

If your time zone had **LMT** (local mean time) in the past and you use such old dates (depends on the time zone, usually 100 or more years ago), don't use **`java.lang.Date`** to read and write them.

If you deal with very old dates (before 1582-10-15) note that **`java.sql.Date`** uses a mixed Julian/Gregorian calendar, **`java.util.GregorianCalendar`** can be configured to proleptic Gregorian with **`setGregorianChange(new java.lang.Date(Long.MN_VALUE))`** and used to read or write fields of dates.

Example:

```
DATE
```

### TIME



### TIME WITH TIME ZONE



### TIMESTAMP



### TIMESTAMP WITH TIME ZONE



### JAVA\_OBJECT



### ENUM

{% hint style="info" %}
```
ENUM (string [, ... ])
```
{% endhint %}

A type with enumerated values. Mapped to **`java.lang.String`**.

Duplicate and empty values are not permitted. The maximum number of values is 65536. The maximum allowed length of complete data type definition with all values is 1,000,000,000 characters.

Example:

```
ENUM('clubs', 'diamonds', 'hearts', 'spades')
```

### GEOMETRY



### JSON



### UUID



### ARRAY



### ROW

