Data types
Write values the way you would in JSON, and HTQL keeps their types.
Parameters and arguments
These are the kinds of value HTQL reads and returns.
TextIn double or single quotes. A quoted text keeps its spaces exactly
Whole numberDigits, with an optional minus
DecimalDigits, a point and digits
Booleantrueorfalse, in any caseNullnull, in any caseListValues or computations in square brackets, of any mix of types, nested as deep as you need
RecordQuoted names and values in braces, nested as deep as you need
An empty list [] and an empty record {} are valid values. Every value above also works as a LET value, as an item in a list and as a field in a record. A list item and a record field may also be a computation, a function call, a comparison or a variable, so a structure can be built from values you already hold.
Examples
One value of each kind, returned in a record.
Return type and behaviour
Values come back with the type they were written with: text as text, numbers as numbers, lists as lists, records as records. Integers stay integers: 3 * 4 is 12, not 12.0. A division that does not come out even gives a decimal: 7 / 2 is 3.5.
Table columns keep their types too. A whole-number column comes back as a number, a flag column as true or false, a JSON column as nested JSON and a timestamp as text in date order.
A date is written as text, such as "2026-01-15", and compares in date order because the year comes first. Text compares character by character and is case sensitive. A number and a text are never equal: 3 = "3" is false.
A bare number returned on its own answers as {"result": 42}.
Errors and exceptions
| Error | What happened | How to recover |
|---|---|---|
HTQL-4012 | A list was written directly after RETURN: RETURN [1, 2, 3] | Return a record, RETURN {"list": [1, 2, 3]}, or hold the list in a variable and return that |
HTQL-2008 | A bare true or null was written directly after RETURN | Put it inside a record: RETURN {"ok": true} |
HTQL-4006 | A record's name has a space or another character that is not a letter, digit, dot or underscore | Rename it, for example "orderTotal" |
HTQL-1003 | A number was written as 1e3 or .5, or the statement is not in HTQL's grammar | Write 1000 or 0.5 |
Limitations
- A number has no exponent form (
1e3) and no leading point (.5). Write1000and0.5. - In a RETURN, a record's names use letters, digits, dots and underscores. A name such as
"Order Total"is refused withHTQL-4006; write"orderTotal". - Inside single quotes, a doubled apostrophe
''stands for one apostrophe. Inside double quotes, write an apostrophe as it is:"it's". - A date has no type of its own. Write it as text in the form
2026-01-15.
Best practices
- Quote text and leave numbers and booleans bare.
- Write a date as text in the form
2026-01-15. - Build the nested shape your application reads inside one RETURN, instead of reshaping it in code.
- Hold a value in a
LETonly when you read it more than once.