Skip to content

Commit

Permalink
Simplify char type docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mosabua committed Jan 27, 2025
1 parent 1350a8b commit b06d765
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/src/main/sphinx/language/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ Single quotes in string literals can be escaped by using another single quote:

### `CHAR`

Fixed length character data. A `CHAR` type without length specified has a default length of 1.
A `CHAR(x)` value always has `x` characters. For example, casting `dog` to `CHAR(7)`
adds 4 implicit trailing spaces. Leading and trailing spaces are included in comparisons of
`CHAR` values. As a result, two character values with different lengths (`CHAR(x)` and
`CHAR(y)` where `x != y`) will never be equal. As with `VARCHAR`, a single quote in a `CHAR`
literal can be escaped with another single quote:
Fixed length character data. A `CHAR` type without length specified has a
default length of 1. A `CHAR(x)` value always has a fixed length of `x`
characters. For example, casting `dog` to `CHAR(7)` adds four implicit trailing
spaces.

As with `VARCHAR`, a single quote in a `CHAR` literal can be escaped with
another single quote:

```sql
SELECT CHAR 'All right, Mr. DeMille, I''m ready for my close-up.'
```
Expand Down

0 comments on commit b06d765

Please sign in to comment.