| 1 |
# Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 2 |
# and the EPL 1.0 (https://h2database.com/html/license.html). |
| 3 |
# Initial Developer: H2 Group |
| 4 |
|
| 5 |
"SECTION","TOPIC","SYNTAX","TEXT","EXAMPLE" |
| 6 |
|
| 7 |
"Commands (DML)","SELECT"," |
| 8 |
SELECT [ DISTINCT @h2@ [ ON ( expression [,...] ) ] | ALL ] |
| 9 |
selectExpression [,...] |
| 10 |
[ FROM tableExpression [,...] ] |
| 11 |
[ WHERE expression ] |
| 12 |
[ GROUP BY groupingElement [,...] ] [ HAVING expression ] |
| 13 |
[ WINDOW { { windowName AS windowSpecification } [,...] } ] |
| 14 |
@h2@ [ QUALIFY expression ] |
| 15 |
[ { UNION [ ALL ] | EXCEPT | INTERSECT } query ] |
| 16 |
[ ORDER BY selectOrder [,...] ] |
| 17 |
[ OFFSET expression { ROW | ROWS } ] |
| 18 |
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS } |
| 19 |
{ ONLY | WITH TIES } ] |
| 20 |
@h2@ [ FOR UPDATE [ NOWAIT | WAIT secondsNumeric | SKIP LOCKED ] ] |
| 21 |
"," |
| 22 |
Selects data from a table or multiple tables. |
| 23 |
|
| 24 |
Command is executed in the following logical order: |
| 25 |
|
| 26 |
1. Data is taken from table value expressions that are specified in the FROM clause, joins are executed. |
| 27 |
If FROM clause is not specified a single row is constructed. |
| 28 |
|
| 29 |
2. WHERE filters rows. Aggregate or window functions are not allowed in this clause. |
| 30 |
|
| 31 |
3. GROUP BY groups the result by the given expression(s). |
| 32 |
If GROUP BY clause is not specified, but non-window aggregate functions are used or HAVING is specified |
| 33 |
all rows are grouped together. |
| 34 |
|
| 35 |
4. Aggregate functions are evaluated. |
| 36 |
|
| 37 |
5. HAVING filters rows after grouping and evaluation of aggregate functions. |
| 38 |
Non-window aggregate functions are allowed in this clause. |
| 39 |
|
| 40 |
6. Window functions are evaluated. |
| 41 |
|
| 42 |
7. QUALIFY filters rows after evaluation of window functions. |
| 43 |
Aggregate and window functions are allowed in this clause. |
| 44 |
|
| 45 |
8. DISTINCT removes duplicates. |
| 46 |
If DISTINCT ON is used only the specified expressions are checked for duplicates; |
| 47 |
ORDER BY clause, if any, is used to determine preserved rows. |
| 48 |
First row is each DISTINCT ON group is preserved. |
| 49 |
In absence of ORDER BY preserved rows are not determined, database may choose any row from each DISTINCT ON group. |
| 50 |
|
| 51 |
9. UNION, EXCEPT, and INTERSECT combine the result of this query with the results of another query. |
| 52 |
INTERSECT has higher precedence than UNION and EXCEPT. |
| 53 |
Operators with equal precedence are evaluated from left to right. |
| 54 |
|
| 55 |
10. ORDER BY sorts the result by the given column(s) or expression(s). |
| 56 |
|
| 57 |
11. Number of rows in output can be limited with OFFSET and FETCH clauses. |
| 58 |
OFFSET specifies how many rows to skip. |
| 59 |
Please note that queries with high offset values can be slow. |
| 60 |
FETCH FIRST/NEXT limits the number of rows returned by the query. |
| 61 |
If PERCENT is specified number of rows is specified as a percent of the total number of rows |
| 62 |
and should be an integer value between 0 and 100 inclusive. |
| 63 |
WITH TIES can be used only together with ORDER BY and means that all additional rows that have the same sorting position |
| 64 |
as the last row will be also returned. |
| 65 |
|
| 66 |
WINDOW clause specifies window definitions for window functions and window aggregate functions. |
| 67 |
This clause can be used to reuse the same definition in multiple functions. |
| 68 |
|
| 69 |
If FOR UPDATE is specified, the tables or rows are locked for writing. |
| 70 |
If some rows are locked by another session, this query will wait some time for release of these locks, |
| 71 |
unless NOWAIT or SKIP LOCKED is specified. |
| 72 |
If SKIP LOCKED is specified, these locked rows will be excluded from result of this query. |
| 73 |
If NOWAIT is specified, presence of these rows will stop execution of this query immediately. |
| 74 |
If WAIT with timeout is specified and some rows are locked by another session, |
| 75 |
this timeout will be used instead of default timeout for this session. |
| 76 |
Please note that with current implementation the timeout doesn't limit execution time of the whole query, |
| 77 |
it only limits wait time for completion of particular transaction that holds a lock on a row selected by this query. |
| 78 |
|
| 79 |
This clause is not allowed in DISTINCT queries and in queries with non-window aggregates, GROUP BY, or HAVING clauses. |
| 80 |
Only the selected rows are locked as in an UPDATE statement. |
| 81 |
Rows from the right side of a left join and from the left side of a right join, including nested joins, aren't locked. |
| 82 |
Locking behavior for rows that were excluded from result using OFFSET / FETCH / LIMIT / TOP or QUALIFY is undefined, |
| 83 |
to avoid possible locking of excessive rows try to filter out unneeded rows with the WHERE criteria when possible. |
| 84 |
Rows are processed one by one. Each row is read, tested with WHERE criteria, locked, read again and re-tested, |
| 85 |
because its value may be changed by concurrent transaction before lock acquisition. |
| 86 |
Note that new uncommitted rows from other transactions are not visible unless read uncommitted isolation level is used |
| 87 |
and therefore cannot be selected and locked. |
| 88 |
Modified uncommitted rows from other transactions that satisfy the WHERE criteria cause this SELECT to wait for |
| 89 |
commit or rollback of those transactions. |
| 90 |
"," |
| 91 |
SELECT * FROM TEST; |
| 92 |
SELECT * FROM TEST ORDER BY NAME; |
| 93 |
SELECT ID, COUNT(*) FROM TEST GROUP BY ID; |
| 94 |
SELECT NAME, COUNT(*) FROM TEST GROUP BY NAME HAVING COUNT(*) > 2; |
| 95 |
SELECT 'ID' COL, MAX(ID) AS MAX FROM TEST UNION SELECT 'NAME', MAX(NAME) FROM TEST; |
| 96 |
SELECT * FROM TEST OFFSET 1000 ROWS FETCH FIRST 1000 ROWS ONLY; |
| 97 |
SELECT A, B FROM TEST ORDER BY A FETCH FIRST 10 ROWS WITH TIES; |
| 98 |
SELECT * FROM (SELECT ID, COUNT(*) FROM TEST |
| 99 |
GROUP BY ID UNION SELECT NULL, COUNT(*) FROM TEST) |
| 100 |
ORDER BY 1 NULLS LAST; |
| 101 |
SELECT DISTINCT C1, C2 FROM TEST; |
| 102 |
SELECT DISTINCT ON(C1) C1, C2 FROM TEST ORDER BY C1; |
| 103 |
SELECT ID, V FROM TEST WHERE ID IN (1, 2, 3) FOR UPDATE WAIT 0.5; |
| 104 |
" |
| 105 |
|
| 106 |
"Commands (DML)","INSERT"," |
| 107 |
INSERT INTO [schemaName.]tableName [ ( columnName [,...] ) ] |
| 108 |
{ [ overrideClause ] { insertValues | @h2@ [ DIRECT ] query } } |
| 109 |
| DEFAULT VALUES |
| 110 |
"," |
| 111 |
Inserts a new row / new rows into a table. |
| 112 |
|
| 113 |
When using DIRECT, then the results from the query are directly applied in the target table without any intermediate step. |
| 114 |
"," |
| 115 |
INSERT INTO TEST VALUES(1, 'Hello') |
| 116 |
" |
| 117 |
|
| 118 |
"Commands (DML)","UPDATE"," |
| 119 |
UPDATE [schemaName.]tableName [ [ AS ] newTableAlias ] SET setClauseList |
| 120 |
[ WHERE expression ] @c@ [ ORDER BY sortSpecificationList ] |
| 121 |
@h2@ FETCH { FIRST | NEXT } [ expression ] { ROW | ROWS } ONLY |
| 122 |
"," |
| 123 |
Updates data in a table. |
| 124 |
ORDER BY is supported for MySQL compatibility, but it is ignored. |
| 125 |
If FETCH is specified, at most the specified number of rows are updated (no limit if null or smaller than zero). |
| 126 |
"," |
| 127 |
UPDATE TEST SET NAME='Hi' WHERE ID=1; |
| 128 |
UPDATE PERSON P SET NAME=(SELECT A.NAME FROM ADDRESS A WHERE A.ID=P.ID); |
| 129 |
" |
| 130 |
|
| 131 |
"Commands (DML)","DELETE"," |
| 132 |
DELETE FROM [schemaName.]tableName |
| 133 |
[ WHERE expression ] |
| 134 |
@h2@ FETCH { FIRST | NEXT } [ expression ] { ROW | ROWS } ONLY |
| 135 |
"," |
| 136 |
Deletes rows form a table. |
| 137 |
If FETCH is specified, at most the specified number of rows are deleted (no limit if null or smaller than zero). |
| 138 |
"," |
| 139 |
DELETE FROM TEST WHERE ID=2 |
| 140 |
" |
| 141 |
|
| 142 |
"Commands (DML)","BACKUP"," |
| 143 |
@h2@ BACKUP TO fileNameString |
| 144 |
"," |
| 145 |
Backs up the database files to a .zip file. Objects are not locked, but |
| 146 |
the backup is transactionally consistent because the transaction log is also copied. |
| 147 |
Admin rights are required to execute this command. |
| 148 |
"," |
| 149 |
BACKUP TO 'backup.zip' |
| 150 |
" |
| 151 |
|
| 152 |
"Commands (DML)","CALL"," |
| 153 |
CALL expression |
| 154 |
"," |
| 155 |
Calculates a simple expression. This statement returns a result set with one row, |
| 156 |
except if the called function returns a result set itself. |
| 157 |
If the called function returns an array, then each element in this array is returned as a column. |
| 158 |
"," |
| 159 |
CALL 15*25 |
| 160 |
" |
| 161 |
|
| 162 |
"Commands (DML)","EXECUTE IMMEDIATE"," |
| 163 |
EXECUTE IMMEDIATE sqlString |
| 164 |
"," |
| 165 |
Dynamically prepares and executes the SQL command specified as a string. Query commands may not be used. |
| 166 |
"," |
| 167 |
EXECUTE IMMEDIATE 'ALTER TABLE TEST DROP CONSTRAINT ' || |
| 168 |
QUOTE_IDENT((SELECT CONSTRAINT_NAME |
| 169 |
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS |
| 170 |
WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'TEST' |
| 171 |
AND CONSTRAINT_TYPE = 'UNIQUE')); |
| 172 |
" |
| 173 |
|
| 174 |
"Commands (DML)","EXPLAIN"," |
| 175 |
@h2@ EXPLAIN { [ PLAN FOR ] | ANALYZE } |
| 176 |
@h2@ { query | insert | update | delete | mergeInto | mergeUsing } |
| 177 |
"," |
| 178 |
Shows the execution plan for a statement. |
| 179 |
When using EXPLAIN ANALYZE, the statement is actually executed, and the query plan |
| 180 |
will include the actual row scan count for each table. |
| 181 |
"," |
| 182 |
EXPLAIN SELECT * FROM TEST WHERE ID=1 |
| 183 |
" |
| 184 |
|
| 185 |
"Commands (DML)","MERGE INTO"," |
| 186 |
@h2@ MERGE INTO [schemaName.]tableName [ ( columnName [,...] ) ] |
| 187 |
@h2@ [ KEY ( columnName [,...] ) ] |
| 188 |
@h2@ { insertValues | query } |
| 189 |
"," |
| 190 |
Updates existing rows, and insert rows that don't exist. If no key column is |
| 191 |
specified, the primary key columns are used to find the row. If more than one |
| 192 |
row per new row is affected, an exception is thrown. |
| 193 |
"," |
| 194 |
MERGE INTO TEST KEY(ID) VALUES(2, 'World') |
| 195 |
" |
| 196 |
|
| 197 |
"Commands (DML)","MERGE USING"," |
| 198 |
MERGE INTO [schemaName.]targetTableName [ [AS] targetAlias] |
| 199 |
USING tableExpression |
| 200 |
ON expression |
| 201 |
mergeWhenClause [,...] |
| 202 |
"," |
| 203 |
Updates or deletes existing rows, and insert rows that don't exist. |
| 204 |
|
| 205 |
The ON clause specifies the matching column expression. |
| 206 |
|
| 207 |
Different rows from a source table may not match with the same target row |
| 208 |
(this is not ensured by H2 if target table is an updatable view). |
| 209 |
One source row may be matched with multiple target rows. |
| 210 |
|
| 211 |
If statement doesn't need a source table a DUAL table can be substituted. |
| 212 |
"," |
| 213 |
MERGE INTO TARGET_TABLE AS T USING SOURCE_TABLE AS S |
| 214 |
ON T.ID = S.ID |
| 215 |
WHEN MATCHED AND T.COL2 <> 'FINAL' THEN |
| 216 |
UPDATE SET T.COL1 = S.COL1 |
| 217 |
WHEN MATCHED AND T.COL2 = 'FINAL' THEN |
| 218 |
DELETE |
| 219 |
WHEN NOT MATCHED THEN |
| 220 |
INSERT (ID, COL1, COL2) VALUES(S.ID, S.COL1, S.COL2); |
| 221 |
MERGE INTO TARGET_TABLE AS T USING (SELECT * FROM SOURCE_TABLE) AS S |
| 222 |
ON T.ID = S.ID |
| 223 |
WHEN MATCHED AND T.COL2 <> 'FINAL' THEN |
| 224 |
UPDATE SET T.COL1 = S.COL1 |
| 225 |
WHEN MATCHED AND T.COL2 = 'FINAL' THEN |
| 226 |
DELETE |
| 227 |
WHEN NOT MATCHED THEN |
| 228 |
INSERT VALUES (S.ID, S.COL1, S.COL2); |
| 229 |
MERGE INTO TARGET T USING (VALUES (1, 4), (2, 15)) S(ID, V) |
| 230 |
ON T.ID = S.ID |
| 231 |
WHEN MATCHED THEN UPDATE SET V = S.V |
| 232 |
WHEN NOT MATCHED THEN INSERT VALUES (S.ID, S.V); |
| 233 |
MERGE INTO TARGET_TABLE USING DUAL ON ID = 1 |
| 234 |
WHEN NOT MATCHED THEN INSERT VALUES (1, 'Test') |
| 235 |
WHEN MATCHED THEN UPDATE SET NAME = 'Test'; |
| 236 |
" |
| 237 |
|
| 238 |
"Commands (DML)","RUNSCRIPT"," |
| 239 |
@h2@ RUNSCRIPT FROM fileNameString scriptCompressionEncryption |
| 240 |
@h2@ [ CHARSET charsetString ] |
| 241 |
@h2@ { [ QUIRKS_MODE ] [ VARIABLE_BINARY ] | FROM_1X } |
| 242 |
"," |
| 243 |
Runs a SQL script from a file. The script is a text file containing SQL |
| 244 |
statements; each statement must end with ';'. This command can be used to |
| 245 |
restore a database from a backup. The password must be in single quotes; it is |
| 246 |
case sensitive and can contain spaces. |
| 247 |
|
| 248 |
Instead of a file name, a URL may be used. |
| 249 |
To read a stream from the classpath, use the prefix 'classpath:'. |
| 250 |
See the [Pluggable File System](https://h2database.com/html/advanced.html#file_system) section. |
| 251 |
|
| 252 |
The compression algorithm must match the one used when creating the script. |
| 253 |
Instead of a file, a URL may be used. |
| 254 |
|
| 255 |
If ""QUIRKS_MODE"" is specified, the various compatibility quirks for scripts from older versions of H2 are enabled. |
| 256 |
Use this clause when you import script that was generated by H2 1.4.200 or an older version into more recent version. |
| 257 |
|
| 258 |
If ""VARIABLE_BINARY"" is specified, the ""BINARY"" data type will be parsed as ""VARBINARY"". |
| 259 |
Use this clause when you import script that was generated by H2 1.4.200 or an older version into more recent version. |
| 260 |
|
| 261 |
If ""FROM_1X"" is specified, quirks for scripts exported from H2 1.*.* are enabled. |
| 262 |
Use this flag to populate a new database with the data exported from 1.*.* versions of H2. |
| 263 |
This flag also enables ""QUIRKS_MODE"" and ""VARIABLE_BINARY"" implicitly. |
| 264 |
|
| 265 |
Admin rights are required to execute this command. |
| 266 |
"," |
| 267 |
RUNSCRIPT FROM 'backup.sql' |
| 268 |
RUNSCRIPT FROM 'classpath:/com/acme/test.sql' |
| 269 |
RUNSCRIPT FROM 'dump_from_1_4_200.sql' FROM_1X |
| 270 |
" |
| 271 |
|
| 272 |
"Commands (DML)","SCRIPT"," |
| 273 |
@h2@ SCRIPT { [ NODATA ] | [ SIMPLE ] [ COLUMNS ] } |
| 274 |
@h2@ [ NOPASSWORDS ] @h2@ [ NOSETTINGS ] |
| 275 |
@h2@ [ DROP ] @h2@ [ BLOCKSIZE blockSizeInt ] |
| 276 |
@h2@ [ TO fileNameString scriptCompressionEncryption |
| 277 |
[ CHARSET charsetString ] ] |
| 278 |
@h2@ [ TABLE [schemaName.]tableName [, ...] ] |
| 279 |
@h2@ [ SCHEMA schemaName [, ...] ] |
| 280 |
"," |
| 281 |
Creates a SQL script from the database. |
| 282 |
|
| 283 |
NODATA will not emit INSERT statements. |
| 284 |
SIMPLE does not use multi-row insert statements. |
| 285 |
COLUMNS includes column name lists into insert statements. |
| 286 |
If the DROP option is specified, drop statements are created for tables, views, |
| 287 |
and sequences. If the block size is set, CLOB and BLOB values larger than this |
| 288 |
size are split into separate blocks. |
| 289 |
BLOCKSIZE is used when writing out LOB data, and specifies the point at the |
| 290 |
values transition from being inserted as inline values, to be inserted using |
| 291 |
out-of-line commands. |
| 292 |
NOSETTINGS turns off dumping the database settings (the SET XXX commands) |
| 293 |
|
| 294 |
If no 'TO fileName' clause is specified, the |
| 295 |
script is returned as a result set. This command can be used to create a backup |
| 296 |
of the database. For long term storage, it is more portable than copying the |
| 297 |
database files. |
| 298 |
|
| 299 |
If a 'TO fileName' clause is specified, then the whole |
| 300 |
script (including insert statements) is written to this file, and a result set |
| 301 |
without the insert statements is returned. |
| 302 |
|
| 303 |
The password must be in single quotes; it is case sensitive and can contain spaces. |
| 304 |
|
| 305 |
This command locks objects while it is running. |
| 306 |
Admin rights are required to execute this command. |
| 307 |
|
| 308 |
When using the TABLE or SCHEMA option, only the selected table(s) / schema(s) are included. |
| 309 |
"," |
| 310 |
SCRIPT NODATA |
| 311 |
" |
| 312 |
|
| 313 |
"Commands (DML)","SHOW"," |
| 314 |
@c@ SHOW { SCHEMAS | TABLES [ FROM schemaName ] | |
| 315 |
COLUMNS FROM tableName [ FROM schemaName ] } |
| 316 |
"," |
| 317 |
Lists the schemas, tables, or the columns of a table. |
| 318 |
"," |
| 319 |
SHOW TABLES |
| 320 |
" |
| 321 |
|
| 322 |
"Commands (DML)","Explicit table"," |
| 323 |
TABLE [schemaName.]tableName |
| 324 |
[ ORDER BY selectOrder [,...] ] |
| 325 |
[ OFFSET expression { ROW | ROWS } ] |
| 326 |
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS } |
| 327 |
{ ONLY | WITH TIES } ] |
| 328 |
"," |
| 329 |
Selects data from a table. |
| 330 |
|
| 331 |
This command is an equivalent to SELECT * FROM tableName. |
| 332 |
See [SELECT](https://h2database.com/html/commands.html#select) command for description of ORDER BY, OFFSET, and FETCH. |
| 333 |
"," |
| 334 |
TABLE TEST; |
| 335 |
TABLE TEST ORDER BY ID FETCH FIRST ROW ONLY; |
| 336 |
" |
| 337 |
|
| 338 |
"Commands (DML)","Table value"," |
| 339 |
VALUES rowValueExpression [,...] |
| 340 |
[ ORDER BY selectOrder [,...] ] |
| 341 |
[ OFFSET expression { ROW | ROWS } ] |
| 342 |
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS } |
| 343 |
{ ONLY | WITH TIES } ] |
| 344 |
"," |
| 345 |
A list of rows that can be used like a table. |
| 346 |
See See [SELECT](https://h2database.com/html/commands.html#select) command for description of ORDER BY, OFFSET, and FETCH. |
| 347 |
The column list of the resulting table is C1, C2, and so on. |
| 348 |
"," |
| 349 |
VALUES (1, 'Hello'), (2, 'World'); |
| 350 |
" |
| 351 |
|
| 352 |
"Commands (DML)","WITH"," |
| 353 |
WITH [ RECURSIVE ] { name [( columnName [,...] )] AS ( query ) [,...] } |
| 354 |
{ query | @h2@ { insert | update | delete | mergeInto | mergeUsing | createTable } } |
| 355 |
"," |
| 356 |
Can be used to create a recursive or non-recursive query (common table expression). |
| 357 |
For recursive queries the first select has to be a UNION. |
| 358 |
One or more common table entries can be referred to by name. |
| 359 |
Column name declarations are now optional - the column names will be inferred from the named select queries. |
| 360 |
The final action in a WITH statement can be a select, insert, update, merge, delete or create table. |
| 361 |
"," |
| 362 |
WITH RECURSIVE cte(n) AS ( |
| 363 |
SELECT 1 |
| 364 |
UNION ALL |
| 365 |
SELECT n + 1 |
| 366 |
FROM cte |
| 367 |
WHERE n < 100 |
| 368 |
) |
| 369 |
SELECT sum(n) FROM cte; |
| 370 |
|
| 371 |
Example 2: |
| 372 |
WITH cte1 AS ( |
| 373 |
SELECT 1 AS FIRST_COLUMN |
| 374 |
), cte2 AS ( |
| 375 |
SELECT FIRST_COLUMN+1 AS FIRST_COLUMN FROM cte1 |
| 376 |
) |
| 377 |
SELECT sum(FIRST_COLUMN) FROM cte2; |
| 378 |
" |
| 379 |
|
| 380 |
"Commands (DDL)","ALTER DOMAIN"," |
| 381 |
ALTER DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName |
| 382 |
{ SET DEFAULT expression } |
| 383 |
| { DROP DEFAULT } |
| 384 |
| @h2@ { SET ON UPDATE expression } |
| 385 |
| @h2@ { DROP ON UPDATE } |
| 386 |
"," |
| 387 |
Changes the default or on update expression of a domain. |
| 388 |
Schema owner rights are required to execute this command. |
| 389 |
|
| 390 |
SET DEFAULT changes the default expression of a domain. |
| 391 |
|
| 392 |
DROP DEFAULT removes the default expression of a domain. |
| 393 |
Old expression is copied into domains and columns that use this domain and don't have an own default expression. |
| 394 |
|
| 395 |
SET ON UPDATE changes the expression that is set on update if value for this domain is not specified in update |
| 396 |
statement. |
| 397 |
|
| 398 |
DROP ON UPDATE removes the expression that is set on update of a column with this domain. |
| 399 |
Old expression is copied into domains and columns that use this domain and don't have an own on update expression. |
| 400 |
|
| 401 |
This command commits an open transaction in this connection. |
| 402 |
"," |
| 403 |
ALTER DOMAIN D1 SET DEFAULT ''; |
| 404 |
ALTER DOMAIN D1 DROP DEFAULT; |
| 405 |
ALTER DOMAIN D1 SET ON UPDATE CURRENT_TIMESTAMP; |
| 406 |
ALTER DOMAIN D1 DROP ON UPDATE; |
| 407 |
" |
| 408 |
|
| 409 |
"Commands (DDL)","ALTER DOMAIN ADD CONSTRAINT"," |
| 410 |
ALTER DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName |
| 411 |
ADD [ constraintNameDefinition ] |
| 412 |
CHECK (condition) @h2@ [ CHECK | NOCHECK ] |
| 413 |
"," |
| 414 |
Adds a constraint to a domain. |
| 415 |
Schema owner rights are required to execute this command. |
| 416 |
This command commits an open transaction in this connection. |
| 417 |
"," |
| 418 |
ALTER DOMAIN D ADD CONSTRAINT D_POSITIVE CHECK (VALUE > 0) |
| 419 |
" |
| 420 |
|
| 421 |
"Commands (DDL)","ALTER DOMAIN DROP CONSTRAINT"," |
| 422 |
ALTER DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName |
| 423 |
DROP CONSTRAINT @h2@ [ IF EXISTS ] [schemaName.]constraintName |
| 424 |
"," |
| 425 |
Removes a constraint from a domain. |
| 426 |
Schema owner rights are required to execute this command. |
| 427 |
This command commits an open transaction in this connection. |
| 428 |
"," |
| 429 |
ALTER DOMAIN D DROP CONSTRAINT D_POSITIVE |
| 430 |
" |
| 431 |
|
| 432 |
"Commands (DDL)","ALTER DOMAIN RENAME"," |
| 433 |
@h2@ ALTER DOMAIN [ IF EXISTS ] [schemaName.]domainName RENAME TO newName |
| 434 |
"," |
| 435 |
Renames a domain. |
| 436 |
Schema owner rights are required to execute this command. |
| 437 |
This command commits an open transaction in this connection. |
| 438 |
"," |
| 439 |
ALTER DOMAIN TEST RENAME TO MY_TYPE |
| 440 |
" |
| 441 |
|
| 442 |
"Commands (DDL)","ALTER DOMAIN RENAME CONSTRAINT"," |
| 443 |
@h2@ ALTER DOMAIN [ IF EXISTS ] [schemaName.]domainName |
| 444 |
@h2@ RENAME CONSTRAINT [schemaName.]oldConstraintName |
| 445 |
@h2@ TO newConstraintName |
| 446 |
"," |
| 447 |
Renames a constraint. |
| 448 |
This command commits an open transaction in this connection. |
| 449 |
"," |
| 450 |
ALTER DOMAIN D RENAME CONSTRAINT FOO TO BAR |
| 451 |
" |
| 452 |
|
| 453 |
"Commands (DDL)","ALTER INDEX RENAME"," |
| 454 |
@h2@ ALTER INDEX [ IF EXISTS ] [schemaName.]indexName RENAME TO newIndexName |
| 455 |
"," |
| 456 |
Renames an index. |
| 457 |
This command commits an open transaction in this connection. |
| 458 |
"," |
| 459 |
ALTER INDEX IDXNAME RENAME TO IDX_TEST_NAME |
| 460 |
" |
| 461 |
|
| 462 |
"Commands (DDL)","ALTER SCHEMA RENAME"," |
| 463 |
@h2@ ALTER SCHEMA [ IF EXISTS ] schemaName RENAME TO newSchemaName |
| 464 |
"," |
| 465 |
Renames a schema. |
| 466 |
Schema admin rights are required to execute this command. |
| 467 |
This command commits an open transaction in this connection. |
| 468 |
"," |
| 469 |
ALTER SCHEMA TEST RENAME TO PRODUCTION |
| 470 |
" |
| 471 |
|
| 472 |
"Commands (DDL)","ALTER SEQUENCE"," |
| 473 |
ALTER SEQUENCE @h2@ [ IF EXISTS ] [schemaName.]sequenceName alterSequenceOption [...] |
| 474 |
"," |
| 475 |
Changes the parameters of a sequence. |
| 476 |
Schema owner rights are required to execute this command. |
| 477 |
This command does not commit the current transaction; however the new value is used by other |
| 478 |
transactions immediately, and rolling back this command has no effect. |
| 479 |
"," |
| 480 |
ALTER SEQUENCE SEQ_ID RESTART WITH 1000 |
| 481 |
" |
| 482 |
|
| 483 |
"Commands (DDL)","ALTER TABLE ADD"," |
| 484 |
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName ADD [ COLUMN ] |
| 485 |
{ @h2@ [ IF NOT EXISTS ] columnName columnDefinition @h2@ [ USING initialValueExpression ] |
| 486 |
| @h2@ { ( { columnName columnDefinition | tableConstraintDefinition } [,...] ) } } |
| 487 |
@h2@ [ { { BEFORE | AFTER } columnName } | FIRST ] |
| 488 |
"," |
| 489 |
Adds a new column to a table. |
| 490 |
This command commits an open transaction in this connection. |
| 491 |
|
| 492 |
If USING is specified the provided expression is used to generate initial value of the new column for each row. |
| 493 |
The expression may reference existing columns of the table. |
| 494 |
Otherwise the DEFAULT expression is used, if any. |
| 495 |
If neither USING nor DEFAULT are specified, the NULL is used. |
| 496 |
"," |
| 497 |
ALTER TABLE TEST ADD CREATEDATE TIMESTAMP |
| 498 |
" |
| 499 |
|
| 500 |
"Commands (DDL)","ALTER TABLE ADD CONSTRAINT"," |
| 501 |
ALTER TABLE @h2@ [ IF EXISTS ] tableName ADD tableConstraintDefinition @h2@ [ CHECK | NOCHECK ] |
| 502 |
"," |
| 503 |
Adds a constraint to a table. If NOCHECK is specified, existing rows are not |
| 504 |
checked for consistency (the default is to check consistency for existing rows). |
| 505 |
The required indexes are automatically created if they don't exist yet. |
| 506 |
It is not possible to disable checking for unique constraints. |
| 507 |
This command commits an open transaction in this connection. |
| 508 |
"," |
| 509 |
ALTER TABLE TEST ADD CONSTRAINT NAME_UNIQUE UNIQUE(NAME) |
| 510 |
" |
| 511 |
|
| 512 |
"Commands (DDL)","ALTER TABLE RENAME CONSTRAINT"," |
| 513 |
@h2@ ALTER TABLE [ IF EXISTS ] [schemaName.]tableName |
| 514 |
@h2@ RENAME CONSTRAINT [schemaName.]oldConstraintName |
| 515 |
@h2@ TO newConstraintName |
| 516 |
"," |
| 517 |
Renames a constraint. |
| 518 |
This command commits an open transaction in this connection. |
| 519 |
"," |
| 520 |
ALTER TABLE TEST RENAME CONSTRAINT FOO TO BAR |
| 521 |
" |
| 522 |
|
| 523 |
"Commands (DDL)","ALTER TABLE ALTER COLUMN"," |
| 524 |
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName |
| 525 |
ALTER COLUMN @h2@ [ IF EXISTS ] columnName |
| 526 |
{ @h2@ { columnDefinition } |
| 527 |
| @h2@ { RENAME TO name } |
| 528 |
| SET GENERATED { ALWAYS | BY DEFAULT } [ alterIdentityColumnOption [...] ] |
| 529 |
| alterIdentityColumnOption [...] |
| 530 |
| DROP IDENTITY |
| 531 |
| @h2@ { SELECTIVITY int } |
| 532 |
| { SET DEFAULT expression } |
| 533 |
| { DROP DEFAULT } |
| 534 |
| DROP EXPRESSION |
| 535 |
| @h2@ { SET ON UPDATE expression } |
| 536 |
| @h2@ { DROP ON UPDATE } |
| 537 |
| @h2@ { SET DEFAULT ON NULL } |
| 538 |
| @h2@ { DROP DEFAULT ON NULL } |
| 539 |
| { SET NOT NULL } |
| 540 |
| { DROP NOT NULL } | @c@ { SET NULL } |
| 541 |
| { SET DATA TYPE dataTypeOrDomain @h2@ [ USING newValueExpression ] } |
| 542 |
| @h2@ { SET { VISIBLE | INVISIBLE } } } |
| 543 |
"," |
| 544 |
Changes the data type of a column, rename a column, |
| 545 |
change the identity value, or change the selectivity. |
| 546 |
|
| 547 |
Changing the data type fails if the data can not be converted. |
| 548 |
|
| 549 |
SET GENERATED ALWAYS, SET GENERATED BY DEFAULT, or identity options convert the column into identity column |
| 550 |
(if it wasn't an identity column) and set new values of specified options for its sequence. |
| 551 |
|
| 552 |
DROP IDENTITY removes identity status of a column. |
| 553 |
|
| 554 |
SELECTIVITY sets the selectivity (1-100) for a column. |
| 555 |
Setting the selectivity to 0 means the default value. |
| 556 |
Selectivity is used by the cost based optimizer to calculate the estimated cost of an index. |
| 557 |
Selectivity 100 means values are unique, 10 means every distinct value appears 10 times on average. |
| 558 |
|
| 559 |
SET DEFAULT changes the default value of a column. |
| 560 |
This command doesn't affect generated and identity columns. |
| 561 |
|
| 562 |
DROP DEFAULT removes the default value of a column. |
| 563 |
|
| 564 |
DROP EXPRESSION converts generated column into base column. |
| 565 |
|
| 566 |
SET ON UPDATE changes the value that is set on update if value for this column is not specified in update statement. |
| 567 |
This command doesn't affect generated and identity columns. |
| 568 |
|
| 569 |
DROP ON UPDATE removes the value that is set on update of a column. |
| 570 |
|
| 571 |
SET DEFAULT ON NULL makes NULL value work as DEFAULT value is assignments to this column. |
| 572 |
|
| 573 |
DROP DEFAULT ON NULL makes NULL value work as NULL value in assignments to this column. |
| 574 |
|
| 575 |
SET NOT NULL sets a column to not allow NULL. Rows may not contain NULL in this column. |
| 576 |
|
| 577 |
DROP NOT NULL and SET NULL set a column to allow NULL. |
| 578 |
The column may not be part of a primary key and may not be an identity column. |
| 579 |
|
| 580 |
SET DATA TYPE changes the data type of a column, for each row old value is converted to this data type |
| 581 |
unless USING is specified with a custom expression. |
| 582 |
USING expression may reference previous value of the modified column by its name and values of other columns. |
| 583 |
|
| 584 |
SET INVISIBLE makes the column hidden, i.e. it will not appear in SELECT * results. |
| 585 |
SET VISIBLE has the reverse effect. |
| 586 |
|
| 587 |
This command commits an open transaction in this connection. |
| 588 |
"," |
| 589 |
ALTER TABLE TEST ALTER COLUMN NAME CLOB; |
| 590 |
ALTER TABLE TEST ALTER COLUMN NAME RENAME TO TEXT; |
| 591 |
ALTER TABLE TEST ALTER COLUMN ID RESTART WITH 10000; |
| 592 |
ALTER TABLE TEST ALTER COLUMN NAME SELECTIVITY 100; |
| 593 |
ALTER TABLE TEST ALTER COLUMN NAME SET DEFAULT ''; |
| 594 |
ALTER TABLE TEST ALTER COLUMN NAME SET NOT NULL; |
| 595 |
ALTER TABLE TEST ALTER COLUMN NAME SET NULL; |
| 596 |
ALTER TABLE TEST ALTER COLUMN NAME SET VISIBLE; |
| 597 |
ALTER TABLE TEST ALTER COLUMN NAME SET INVISIBLE; |
| 598 |
" |
| 599 |
|
| 600 |
"Commands (DDL)","ALTER TABLE DROP COLUMN"," |
| 601 |
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName |
| 602 |
DROP [ COLUMN ] @h2@ [ IF EXISTS ] |
| 603 |
@h2@ { ( columnName [,...] ) } | columnName @c@ [,...] |
| 604 |
"," |
| 605 |
Removes column(s) from a table. |
| 606 |
This command commits an open transaction in this connection. |
| 607 |
"," |
| 608 |
ALTER TABLE TEST DROP COLUMN NAME |
| 609 |
ALTER TABLE TEST DROP COLUMN (NAME1, NAME2) |
| 610 |
" |
| 611 |
|
| 612 |
"Commands (DDL)","ALTER TABLE DROP CONSTRAINT"," |
| 613 |
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName DROP |
| 614 |
CONSTRAINT @h2@ [ IF EXISTS ] [schemaName.]constraintName [ RESTRICT | CASCADE ] | @c@ { PRIMARY KEY } |
| 615 |
"," |
| 616 |
Removes a constraint or a primary key from a table. |
| 617 |
If CASCADE is specified, unique or primary key constraint is dropped together with all |
| 618 |
referential constraints that reference the specified constraint. |
| 619 |
This command commits an open transaction in this connection. |
| 620 |
"," |
| 621 |
ALTER TABLE TEST DROP CONSTRAINT UNIQUE_NAME RESTRICT |
| 622 |
" |
| 623 |
|
| 624 |
"Commands (DDL)","ALTER TABLE SET"," |
| 625 |
@h2@ ALTER TABLE [ IF EXISTS ] [schemaName.]tableName |
| 626 |
SET REFERENTIAL_INTEGRITY |
| 627 |
@h2@ { FALSE | TRUE } @h2@ [ CHECK | NOCHECK ] |
| 628 |
"," |
| 629 |
Disables or enables referential integrity checking for a table. This command can |
| 630 |
be used inside a transaction. Enabling referential integrity does not check |
| 631 |
existing data, except if CHECK is specified. Use SET REFERENTIAL_INTEGRITY to |
| 632 |
disable it for all tables; the global flag and the flag for each table are |
| 633 |
independent. |
| 634 |
|
| 635 |
This command commits an open transaction in this connection. |
| 636 |
"," |
| 637 |
ALTER TABLE TEST SET REFERENTIAL_INTEGRITY FALSE |
| 638 |
" |
| 639 |
|
| 640 |
"Commands (DDL)","ALTER TABLE RENAME"," |
| 641 |
@h2@ ALTER TABLE [ IF EXISTS ] [schemaName.]tableName RENAME TO newName |
| 642 |
"," |
| 643 |
Renames a table. |
| 644 |
This command commits an open transaction in this connection. |
| 645 |
"," |
| 646 |
ALTER TABLE TEST RENAME TO MY_DATA |
| 647 |
" |
| 648 |
|
| 649 |
"Commands (DDL)","ALTER USER ADMIN"," |
| 650 |
@h2@ ALTER USER userName ADMIN { TRUE | FALSE } |
| 651 |
"," |
| 652 |
Switches the admin flag of a user on or off. |
| 653 |
|
| 654 |
Only unquoted or uppercase user names are allowed. |
| 655 |
Admin rights are required to execute this command. |
| 656 |
This command commits an open transaction in this connection. |
| 657 |
"," |
| 658 |
ALTER USER TOM ADMIN TRUE |
| 659 |
" |
| 660 |
|
| 661 |
"Commands (DDL)","ALTER USER RENAME"," |
| 662 |
@h2@ ALTER USER userName RENAME TO newUserName |
| 663 |
"," |
| 664 |
Renames a user. |
| 665 |
After renaming a user, the password becomes invalid and needs to be changed as well. |
| 666 |
|
| 667 |
Only unquoted or uppercase user names are allowed. |
| 668 |
Admin rights are required to execute this command. |
| 669 |
This command commits an open transaction in this connection. |
| 670 |
"," |
| 671 |
ALTER USER TOM RENAME TO THOMAS |
| 672 |
" |
| 673 |
|
| 674 |
"Commands (DDL)","ALTER USER SET PASSWORD"," |
| 675 |
@h2@ ALTER USER userName SET { PASSWORD string | SALT bytes HASH bytes } |
| 676 |
"," |
| 677 |
Changes the password of a user. |
| 678 |
Only unquoted or uppercase user names are allowed. |
| 679 |
The password must be enclosed in single quotes. It is case sensitive |
| 680 |
and can contain spaces. The salt and hash values are hex strings. |
| 681 |
|
| 682 |
Admin rights are required to execute this command. |
| 683 |
This command commits an open transaction in this connection. |
| 684 |
"," |
| 685 |
ALTER USER SA SET PASSWORD 'rioyxlgt' |
| 686 |
" |
| 687 |
|
| 688 |
"Commands (DDL)","ALTER VIEW RECOMPILE"," |
| 689 |
@h2@ ALTER VIEW [ IF EXISTS ] [schemaName.]viewName RECOMPILE |
| 690 |
"," |
| 691 |
Recompiles a view after the underlying tables have been changed or created. |
| 692 |
Schema owner rights are required to execute this command. |
| 693 |
This command is used for views created using CREATE FORCE VIEW. |
| 694 |
This command commits an open transaction in this connection. |
| 695 |
"," |
| 696 |
ALTER VIEW ADDRESS_VIEW RECOMPILE |
| 697 |
" |
| 698 |
|
| 699 |
"Commands (DDL)","ALTER VIEW RENAME"," |
| 700 |
@h2@ ALTER VIEW [ IF EXISTS ] [schemaName.]viewName RENAME TO newName |
| 701 |
"," |
| 702 |
Renames a view. |
| 703 |
Schema owner rights are required to execute this command. |
| 704 |
This command commits an open transaction in this connection. |
| 705 |
"," |
| 706 |
ALTER VIEW TEST RENAME TO MY_VIEW |
| 707 |
" |
| 708 |
|
| 709 |
"Commands (DDL)","ANALYZE"," |
| 710 |
@h2@ ANALYZE [ TABLE [schemaName.]tableName ] [ SAMPLE_SIZE rowCountInt ] |
| 711 |
"," |
| 712 |
Updates the selectivity statistics of tables. |
| 713 |
If no table name is given, all tables are analyzed. |
| 714 |
The selectivity is used by the |
| 715 |
cost based optimizer to select the best index for a given query. If no sample |
| 716 |
size is set, up to 10000 rows per table are read. The value 0 means all rows are |
| 717 |
read. The selectivity can be set manually using ALTER TABLE ALTER COLUMN |
| 718 |
SELECTIVITY. Manual values are overwritten by this statement. The selectivity is |
| 719 |
available in the INFORMATION_SCHEMA.COLUMNS table. |
| 720 |
|
| 721 |
This command commits an open transaction in this connection. |
| 722 |
"," |
| 723 |
ANALYZE SAMPLE_SIZE 1000 |
| 724 |
" |
| 725 |
|
| 726 |
"Commands (DDL)","COMMENT ON"," |
| 727 |
@h2@ COMMENT ON |
| 728 |
@h2@ { { COLUMN [schemaName.]tableName.columnName } |
| 729 |
| { { TABLE | VIEW | CONSTANT | CONSTRAINT | ALIAS | INDEX | ROLE |
| 730 |
| SCHEMA | SEQUENCE | TRIGGER | USER | DOMAIN } [schemaName.]objectName } } |
| 731 |
@h2@ IS expression |
| 732 |
"," |
| 733 |
Sets the comment of a database object. Use NULL or empty string to remove the comment. |
| 734 |
|
| 735 |
Admin rights are required to execute this command if object is a USER or ROLE. |
| 736 |
Schema owner rights are required to execute this command for all other types of objects. |
| 737 |
This command commits an open transaction in this connection. |
| 738 |
"," |
| 739 |
COMMENT ON TABLE TEST IS 'Table used for testing' |
| 740 |
" |
| 741 |
|
| 742 |
"Commands (DDL)","CREATE AGGREGATE"," |
| 743 |
@h2@ CREATE AGGREGATE [ IF NOT EXISTS ] [schemaName.]aggregateName FOR classNameString |
| 744 |
"," |
| 745 |
Creates a new user-defined aggregate function. The method name must be the full |
| 746 |
qualified class name. The class must implement the interface |
| 747 |
""org.h2.api.Aggregate"" or ""org.h2.api.AggregateFunction"". |
| 748 |
|
| 749 |
Admin rights are required to execute this command. |
| 750 |
This command commits an open transaction in this connection. |
| 751 |
"," |
| 752 |
CREATE AGGREGATE SIMPLE_MEDIAN FOR 'com.acme.db.Median' |
| 753 |
" |
| 754 |
|
| 755 |
"Commands (DDL)","CREATE ALIAS"," |
| 756 |
@h2@ CREATE ALIAS [ IF NOT EXISTS ] [schemaName.]functionAliasName |
| 757 |
@h2@ [ DETERMINISTIC ] |
| 758 |
@h2@ { FOR classAndMethodString | AS sourceCodeString } |
| 759 |
"," |
| 760 |
Creates a new function alias. If this is a ResultSet returning function, |
| 761 |
by default the return value is cached in a local temporary file. |
| 762 |
|
| 763 |
DETERMINISTIC - Deterministic functions must always return the same value for the same parameters. |
| 764 |
|
| 765 |
The method name must be the full qualified class and method name, |
| 766 |
and may optionally include the parameter classes as in |
| 767 |
""java.lang.Integer.parseInt(java.lang.String, int)"". The class and the method |
| 768 |
must both be public, and the method must be static. The class must be available |
| 769 |
in the classpath of the database engine (when using the server mode, |
| 770 |
it must be in the classpath of the server). |
| 771 |
|
| 772 |
When defining a function alias with source code, the Sun ""javac"" is compiler |
| 773 |
is used if the file ""tools.jar"" is in the classpath. If not, ""javac"" is run as a separate process. |
| 774 |
Only the source code is stored in the database; the class is compiled each time |
| 775 |
the database is re-opened. Source code is usually passed |
| 776 |
as dollar quoted text to avoid escaping problems. If import statements are used, |
| 777 |
then the tag @CODE must be added before the method. |
| 778 |
|
| 779 |
If the method throws an SQLException, it is directly re-thrown to the calling application; |
| 780 |
all other exceptions are first converted to a SQLException. |
| 781 |
|
| 782 |
If the first parameter of the Java function is a ""java.sql.Connection"", then a |
| 783 |
connection to the database is provided. This connection must not be closed. |
| 784 |
If the class contains multiple methods with the given name but different |
| 785 |
parameter count, all methods are mapped. |
| 786 |
|
| 787 |
Admin rights are required to execute this command. |
| 788 |
This command commits an open transaction in this connection. |
| 789 |
|
| 790 |
If you have the Groovy jar in your classpath, it is also possible to write methods using Groovy. |
| 791 |
"," |
| 792 |
CREATE ALIAS MY_SQRT FOR 'java.lang.Math.sqrt'; |
| 793 |
CREATE ALIAS MY_ROUND FOR 'java.lang.Math.round(double)'; |
| 794 |
CREATE ALIAS GET_SYSTEM_PROPERTY FOR 'java.lang.System.getProperty'; |
| 795 |
CALL GET_SYSTEM_PROPERTY('java.class.path'); |
| 796 |
CALL GET_SYSTEM_PROPERTY('com.acme.test', 'true'); |
| 797 |
CREATE ALIAS REVERSE AS 'String reverse(String s) { return new StringBuilder(s).reverse().toString(); }'; |
| 798 |
CALL REVERSE('Test'); |
| 799 |
CREATE ALIAS tr AS '@groovy.transform.CompileStatic |
| 800 |
static String tr(String str, String sourceSet, String replacementSet){ |
| 801 |
return str.tr(sourceSet, replacementSet); |
| 802 |
} |
| 803 |
' |
| 804 |
" |
| 805 |
|
| 806 |
"Commands (DDL)","CREATE CONSTANT"," |
| 807 |
@h2@ CREATE CONSTANT [ IF NOT EXISTS ] [schemaName.]constantName |
| 808 |
VALUE expression |
| 809 |
"," |
| 810 |
Creates a new constant. |
| 811 |
Schema owner rights are required to execute this command. |
| 812 |
This command commits an open transaction in this connection. |
| 813 |
"," |
| 814 |
CREATE CONSTANT ONE VALUE 1 |
| 815 |
" |
| 816 |
|
| 817 |
"Commands (DDL)","CREATE DOMAIN"," |
| 818 |
CREATE DOMAIN @h2@ [ IF NOT EXISTS ] [schemaName.]domainName |
| 819 |
[ AS ] dataTypeOrDomain |
| 820 |
[ DEFAULT expression ] |
| 821 |
@h2@ [ ON UPDATE expression ] |
| 822 |
@h2@ [ COMMENT expression ] |
| 823 |
[ CHECK (condition) ] [...] |
| 824 |
"," |
| 825 |
Creates a new domain to define a set of permissible values. |
| 826 |
Schema owner rights are required to execute this command. |
| 827 |
Domains can be used as data types. |
| 828 |
The domain constraints must evaluate to TRUE or to UNKNOWN. |
| 829 |
In the conditions, the term VALUE refers to the value being tested. |
| 830 |
|
| 831 |
This command commits an open transaction in this connection. |
| 832 |
"," |
| 833 |
CREATE DOMAIN EMAIL AS VARCHAR(255) CHECK (POSITION('@', VALUE) > 1) |
| 834 |
" |
| 835 |
|
| 836 |
"Commands (DDL)","CREATE INDEX"," |
| 837 |
@h2@ CREATE [ UNIQUE [ nullsDistinct ] | SPATIAL ] INDEX |
| 838 |
@h2@ [ [ IF NOT EXISTS ] [schemaName.]indexName ] |
| 839 |
@h2@ ON [schemaName.]tableName ( indexColumn [,...] ) |
| 840 |
@h2@ [ INCLUDE ( indexColumn [,...] ) ] |
| 841 |
"," |
| 842 |
Creates a new index. |
| 843 |
This command commits an open transaction in this connection. |
| 844 |
|
| 845 |
INCLUDE clause may only be specified for UNIQUE indexes. |
| 846 |
With this clause additional columns are included into index, but aren't used in unique checks. |
| 847 |
If nulls distinct clause is not specified, the default is NULLS DISTINCT, excluding some compatibility modes. |
| 848 |
|
| 849 |
Spatial indexes are supported only on GEOMETRY columns. |
| 850 |
They may contain only one column and are used by the |
| 851 |
[spatial overlapping operator](https://h2database.com/html/grammar.html#compare). |
| 852 |
"," |
| 853 |
CREATE INDEX IDXNAME ON TEST(NAME) |
| 854 |
" |
| 855 |
|
| 856 |
"Commands (DDL)","CREATE LINKED TABLE"," |
| 857 |
@h2@ CREATE [ FORCE ] [ [ GLOBAL | LOCAL ] TEMPORARY ] |
| 858 |
@h2@ LINKED TABLE [ IF NOT EXISTS ] |
| 859 |
@h2@ [schemaName.]tableName ( driverString, urlString, userString, passwordString, |
| 860 |
@h2@ [ originalSchemaString, ] @h2@ originalTableString ) |
| 861 |
@h2@ [ EMIT UPDATES | READONLY ] [ FETCH_SIZE sizeInt] [AUTOCOMMIT ON|OFF] |
| 862 |
"," |
| 863 |
Creates a table link to an external table. The driver name may be empty if the |
| 864 |
driver is already loaded. If the schema name is not set, only one table with |
| 865 |
that name may exist in the target database. |
| 866 |
|
| 867 |
FORCE - Create the LINKED TABLE even if the remote database/table does not exist. |
| 868 |
|
| 869 |
EMIT UPDATES - Usually, for update statements, the old rows are deleted first and then the new |
| 870 |
rows are inserted. It is possible to emit update statements (except on |
| 871 |
rollback), however in this case multi-row unique key updates may not always |
| 872 |
work. Linked tables to the same database share one connection. |
| 873 |
|
| 874 |
READONLY - is set, the remote table may not be updated. This is enforced by H2. |
| 875 |
|
| 876 |
FETCH_SIZE - the number of rows fetched, a hint with non-negative number of rows to fetch from the external table |
| 877 |
at once, may be ignored by the driver of external database. 0 is default and means no hint. |
| 878 |
The value is passed to ""java.sql.Statement.setFetchSize()"" method. |
| 879 |
|
| 880 |
AUTOCOMMIT - is set to ON, the auto-commit mode is enable. OFF is disable. |
| 881 |
The value is passed to ""java.sql.Connection.setAutoCommit()"" method. |
| 882 |
|
| 883 |
If the connection to the source database is lost, the connection is re-opened |
| 884 |
(this is a workaround for MySQL that disconnects after 8 hours of inactivity by default). |
| 885 |
|
| 886 |
If a query is used instead of the original table name, the table is read only. |
| 887 |
Queries must be enclosed in parenthesis: ""(SELECT * FROM ORDERS)"". |
| 888 |
|
| 889 |
To use JNDI to get the connection, the driver class must be a |
| 890 |
javax.naming.Context (for example ""javax.naming.InitialContext""), and the URL must |
| 891 |
be the resource name (for example ""java:comp/env/jdbc/Test""). |
| 892 |
|
| 893 |
Admin rights are required to execute this command. |
| 894 |
This command commits an open transaction in this connection. |
| 895 |
"," |
| 896 |
CREATE LINKED TABLE LINK('org.h2.Driver', 'jdbc:h2:./test2', |
| 897 |
'sa', 'sa', 'TEST'); |
| 898 |
CREATE LINKED TABLE LINK('', 'jdbc:h2:./test2', 'sa', 'sa', |
| 899 |
'(SELECT * FROM TEST WHERE ID>0)'); |
| 900 |
CREATE LINKED TABLE LINK('javax.naming.InitialContext', |
| 901 |
'java:comp/env/jdbc/Test', NULL, NULL, |
| 902 |
'(SELECT * FROM TEST WHERE ID>0)'); |
| 903 |
" |
| 904 |
|
| 905 |
"Commands (DDL)","CREATE ROLE"," |
| 906 |
CREATE ROLE @h2@ [ IF NOT EXISTS ] newRoleName |
| 907 |
"," |
| 908 |
Creates a new role. |
| 909 |
This command commits an open transaction in this connection. |
| 910 |
"," |
| 911 |
CREATE ROLE READONLY |
| 912 |
" |
| 913 |
|
| 914 |
"Commands (DDL)","CREATE SCHEMA"," |
| 915 |
CREATE SCHEMA @h2@ [ IF NOT EXISTS ] |
| 916 |
{ name [ AUTHORIZATION ownerName ] | [ AUTHORIZATION ownerName ] } |
| 917 |
@h2@ [ WITH tableEngineParamName [,...] ] |
| 918 |
"," |
| 919 |
Creates a new schema. |
| 920 |
Schema admin rights are required to execute this command. |
| 921 |
|
| 922 |
If schema name is not specified, the owner name is used as a schema name. |
| 923 |
If schema name is specified, but no owner is specified, the current user is used as an owner. |
| 924 |
|
| 925 |
Schema owners can create, rename, and drop objects in the schema. |
| 926 |
Schema owners can drop the schema itself, but cannot rename it. |
| 927 |
Some objects may still require admin rights for their creation, |
| 928 |
see documentation of their CREATE statements for details. |
| 929 |
|
| 930 |
Optional table engine parameters are used when CREATE TABLE command |
| 931 |
is run on this schema without having its engine params set. |
| 932 |
|
| 933 |
This command commits an open transaction in this connection. |
| 934 |
"," |
| 935 |
CREATE SCHEMA TEST_SCHEMA AUTHORIZATION SA |
| 936 |
" |
| 937 |
|
| 938 |
"Commands (DDL)","CREATE SEQUENCE"," |
| 939 |
CREATE SEQUENCE @h2@ [ IF NOT EXISTS ] [schemaName.]sequenceName |
| 940 |
[ { AS dataType | sequenceOption } [...] ] |
| 941 |
"," |
| 942 |
Creates a new sequence. |
| 943 |
Schema owner rights are required to execute this command. |
| 944 |
|
| 945 |
The data type of a sequence must be a numeric type, the default is BIGINT. |
| 946 |
Sequence can produce only integer values. |
| 947 |
For TINYINT the allowed values are between -128 and 127. |
| 948 |
For SMALLINT the allowed values are between -32768 and 32767. |
| 949 |
For INTEGER the allowed values are between -2147483648 and 2147483647. |
| 950 |
For BIGINT the allowed values are between -9223372036854775808 and 9223372036854775807. |
| 951 |
For NUMERIC and DECFLOAT the allowed values depend on precision, |
| 952 |
but cannot exceed the range of BIGINT data type (from -9223372036854775808 to 9223372036854775807); |
| 953 |
the scale of NUMERIC must be 0. |
| 954 |
For REAL the allowed values are between -16777216 and 16777216. |
| 955 |
For DOUBLE PRECISION the allowed values are between -9007199254740992 and 9007199254740992. |
| 956 |
|
| 957 |
Used values are never re-used, even when the transaction is rolled back. |
| 958 |
|
| 959 |
This command commits an open transaction in this connection. |
| 960 |
"," |
| 961 |
CREATE SEQUENCE SEQ_ID; |
| 962 |
CREATE SEQUENCE SEQ2 AS INTEGER START WITH 10; |
| 963 |
" |
| 964 |
|
| 965 |
"Commands (DDL)","CREATE TABLE"," |
| 966 |
CREATE @h2@ [ CACHED | MEMORY ] [ @c@ { TEMP } | [ GLOBAL | LOCAL ] TEMPORARY ] |
| 967 |
TABLE @h2@ [ IF NOT EXISTS ] [schemaName.]tableName |
| 968 |
[ ( { columnName [columnDefinition] | tableConstraintDefinition } [,...] ) ] |
| 969 |
@h2@ [ ENGINE tableEngineName ] |
| 970 |
@h2@ [ WITH tableEngineParamName [,...] ] |
| 971 |
@h2@ [ NOT PERSISTENT ] @h2@ [ TRANSACTIONAL ] |
| 972 |
[ AS ( query ) [ WITH [ NO ] DATA ] ]"," |
| 973 |
Creates a new table. |
| 974 |
|
| 975 |
Admin rights are required to execute this command |
| 976 |
if and only if ENGINE option is used or custom default table engine is configured in the database. |
| 977 |
Schema owner rights or ALTER ANY SCHEMA rights are required for creation of regular tables and GLOBAL TEMPORARY tables. |
| 978 |
|
| 979 |
Cached tables (the default for regular tables) are persistent, |
| 980 |
and the number of rows is not limited by the main memory. |
| 981 |
Memory tables (the default for temporary tables) are persistent, |
| 982 |
but the index data is kept in main memory, |
| 983 |
that means memory tables should not get too large. |
| 984 |
|
| 985 |
Temporary tables are deleted when closing or opening a database. |
| 986 |
Temporary tables can be global (accessible by all connections) |
| 987 |
or local (only accessible by the current connection). |
| 988 |
The default for temporary tables is global. |
| 989 |
Indexes of temporary tables are kept fully in main memory, |
| 990 |
unless the temporary table is created using CREATE CACHED TABLE. |
| 991 |
|
| 992 |
The ENGINE option is only required when custom table implementations are used. |
| 993 |
The table engine class must implement the interface ""org.h2.api.TableEngine"". |
| 994 |
Any table engine parameters are passed down in the tableEngineParams field of the CreateTableData object. |
| 995 |
|
| 996 |
Either ENGINE, or WITH (table engine params), or both may be specified. If ENGINE is not specified |
| 997 |
in CREATE TABLE, then the engine specified by DEFAULT_TABLE_ENGINE option of database params is used. |
| 998 |
|
| 999 |
Tables with the NOT PERSISTENT modifier are kept fully in memory, and all |
| 1000 |
rows are lost when the database is closed. |
| 1001 |
|
| 1002 |
The column definitions are optional if a query is specified. |
| 1003 |
In that case the column list of the query is used. |
| 1004 |
If the query is specified its results are inserted into created table unless WITH NO DATA is specified. |
| 1005 |
|
| 1006 |
This command commits an open transaction, except when using |
| 1007 |
TRANSACTIONAL (only supported for temporary tables). |
| 1008 |
"," |
| 1009 |
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255)) |
| 1010 |
" |
| 1011 |
|
| 1012 |
"Commands (DDL)","CREATE TRIGGER"," |
| 1013 |
CREATE TRIGGER @h2@ [ IF NOT EXISTS ] [schemaName.]triggerName |
| 1014 |
{ BEFORE | AFTER | INSTEAD OF } |
| 1015 |
{ INSERT | UPDATE | DELETE | @h2@ { SELECT | ROLLBACK } } |
| 1016 |
@h2@ [,...] ON [schemaName.]tableName [ FOR EACH { ROW | STATEMENT } ] |
| 1017 |
@c@ [ QUEUE int ] @h2@ [ NOWAIT ] |
| 1018 |
@h2@ { CALL triggeredClassNameString | AS sourceCodeString } |
| 1019 |
"," |
| 1020 |
Creates a new trigger. |
| 1021 |
Admin rights are required to execute this command. |
| 1022 |
|
| 1023 |
The trigger class must be public and implement ""org.h2.api.Trigger"". |
| 1024 |
Inner classes are not supported. |
| 1025 |
The class must be available in the classpath of the database engine |
| 1026 |
(when using the server mode, it must be in the classpath of the server). |
| 1027 |
|
| 1028 |
The sourceCodeString must define a single method with no parameters that returns ""org.h2.api.Trigger"". |
| 1029 |
See CREATE ALIAS for requirements regarding the compilation. |
| 1030 |
Alternatively, javax.script.ScriptEngineManager can be used to create an instance of ""org.h2.api.Trigger"". |
| 1031 |
Currently javascript (included in every JRE) and ruby (with JRuby) are supported. |
| 1032 |
In that case the source must begin respectively with ""//javascript"" or ""#ruby"". |
| 1033 |
|
| 1034 |
BEFORE triggers are called after data conversion is made, default values are set, |
| 1035 |
null and length constraint checks have been made; |
| 1036 |
but before other constraints have been checked. |
| 1037 |
If there are multiple triggers, the order in which they are called is undefined. |
| 1038 |
|
| 1039 |
ROLLBACK can be specified in combination with INSERT, UPDATE, and DELETE. |
| 1040 |
Only row based AFTER trigger can be called on ROLLBACK. |
| 1041 |
Exceptions that occur within such triggers are ignored. |
| 1042 |
As the operations that occur within a trigger are part of the transaction, |
| 1043 |
ROLLBACK triggers are only required if an operation communicates outside of the database. |
| 1044 |
|
| 1045 |
INSTEAD OF triggers are implicitly row based and behave like BEFORE triggers. |
| 1046 |
Only the first such trigger is called. Such triggers on views are supported. |
| 1047 |
They can be used to make views updatable. |
| 1048 |
These triggers on INSERT and UPDATE must update the passed new row to values that were actually inserted |
| 1049 |
by the trigger; they are used for [FINAL TABLE](https://h2database.com/html/grammar.html#data_change_delta_table) |
| 1050 |
and for retrieval of generated keys. |
| 1051 |
|
| 1052 |
A BEFORE SELECT trigger is fired just before the database engine tries to read from the table. |
| 1053 |
The trigger can be used to update a table on demand. |
| 1054 |
The trigger is called with both 'old' and 'new' set to null. |
| 1055 |
|
| 1056 |
The MERGE statement will call both INSERT and UPDATE triggers. |
| 1057 |
Not supported are SELECT triggers with the option FOR EACH ROW, |
| 1058 |
and AFTER SELECT triggers. |
| 1059 |
|
| 1060 |
Committing or rolling back a transaction within a trigger is not allowed, except for SELECT triggers. |
| 1061 |
|
| 1062 |
By default a trigger is called once for each statement, without the old and new rows. |
| 1063 |
FOR EACH ROW triggers are called once for each inserted, updated, or deleted row. |
| 1064 |
|
| 1065 |
QUEUE is implemented for syntax compatibility with HSQL and has no effect. |
| 1066 |
|
| 1067 |
The trigger need to be created in the same schema as the table. |
| 1068 |
The schema name does not need to be specified when creating the trigger. |
| 1069 |
|
| 1070 |
This command commits an open transaction in this connection. |
| 1071 |
"," |
| 1072 |
CREATE TRIGGER TRIG_INS BEFORE INSERT ON TEST FOR EACH ROW CALL 'MyTrigger'; |
| 1073 |
CREATE TRIGGER TRIG_SRC BEFORE INSERT ON TEST AS |
| 1074 |
'org.h2.api.Trigger create() { return new MyTrigger(""constructorParam""); }'; |
| 1075 |
CREATE TRIGGER TRIG_JS BEFORE INSERT ON TEST AS '//javascript |
| 1076 |
return new Packages.MyTrigger(""constructorParam"");'; |
| 1077 |
CREATE TRIGGER TRIG_RUBY BEFORE INSERT ON TEST AS '#ruby |
| 1078 |
Java::MyPackage::MyTrigger.new(""constructorParam"")'; |
| 1079 |
" |
| 1080 |
"Commands (DDL)","CREATE USER"," |
| 1081 |
@h2@ CREATE USER [ IF NOT EXISTS ] newUserName |
| 1082 |
@h2@ { PASSWORD string | SALT bytes HASH bytes } @h2@ [ ADMIN ] |
| 1083 |
"," |
| 1084 |
Creates a new user. For compatibility, only unquoted or uppercase user names are allowed. |
| 1085 |
The password must be in single quotes. It is case sensitive and can contain spaces. |
| 1086 |
The salt and hash values are hex strings. |
| 1087 |
|
| 1088 |
Admin rights are required to execute this command. |
| 1089 |
This command commits an open transaction in this connection. |
| 1090 |
"," |
| 1091 |
CREATE USER GUEST PASSWORD 'abc' |
| 1092 |
" |
| 1093 |
|
| 1094 |
"Commands (DDL)","CREATE VIEW"," |
| 1095 |
CREATE @h2@ [ OR REPLACE ] @h2@ [ FORCE ] |
| 1096 |
VIEW @h2@ [ IF NOT EXISTS ] [schemaName.]viewName |
| 1097 |
[ ( columnName [,...] ) ] AS query |
| 1098 |
"," |
| 1099 |
Creates a new view. If the force option is used, then the view is created even |
| 1100 |
if the underlying table(s) don't exist. |
| 1101 |
Schema owner rights are required to execute this command. |
| 1102 |
|
| 1103 |
If the OR REPLACE clause is used an existing view will be replaced, and any |
| 1104 |
dependent views will not need to be recreated. If dependent views will become |
| 1105 |
invalid as a result of the change an error will be generated, but this error |
| 1106 |
can be ignored if the FORCE clause is also used. |
| 1107 |
|
| 1108 |
Views are not updatable except when using 'instead of' triggers. |
| 1109 |
|
| 1110 |
This command commits an open transaction in this connection. |
| 1111 |
"," |
| 1112 |
CREATE VIEW TEST_VIEW AS SELECT * FROM TEST WHERE ID < 100 |
| 1113 |
" |
| 1114 |
|
| 1115 |
"Commands (DDL)","CREATE MATERIALIZED VIEW"," |
| 1116 |
@h2@ CREATE [ OR REPLACE ] |
| 1117 |
@h2@ MATERIALIZED VIEW [ IF NOT EXISTS ] [schemaName.]viewName |
| 1118 |
[ ( columnName [,...] ) ] AS query |
| 1119 |
"," |
| 1120 |
Creates a new materialized view. |
| 1121 |
Schema owner rights are required to execute this command. |
| 1122 |
|
| 1123 |
If the OR REPLACE clause is used an existing view will be replaced. |
| 1124 |
|
| 1125 |
Views are not updatable except using REFRESH MATERIALIZED VIEW. |
| 1126 |
|
| 1127 |
This command commits an open transaction in this connection. |
| 1128 |
"," |
| 1129 |
CREATE MATERIALIZED VIEW TEST_VIEW AS SELECT * FROM TEST WHERE ID < 100 |
| 1130 |
" |
| 1131 |
|
| 1132 |
"Commands (DDL)","DROP AGGREGATE"," |
| 1133 |
@h2@ DROP AGGREGATE [ IF EXISTS ] aggregateName |
| 1134 |
"," |
| 1135 |
Drops an existing user-defined aggregate function. |
| 1136 |
Schema owner rights are required to execute this command. |
| 1137 |
|
| 1138 |
This command commits an open transaction in this connection. |
| 1139 |
"," |
| 1140 |
DROP AGGREGATE SIMPLE_MEDIAN |
| 1141 |
" |
| 1142 |
|
| 1143 |
"Commands (DDL)","DROP ALIAS"," |
| 1144 |
@h2@ DROP ALIAS [ IF EXISTS ] [schemaName.]aliasName |
| 1145 |
"," |
| 1146 |
Drops an existing function alias. |
| 1147 |
Schema owner rights are required to execute this command. |
| 1148 |
|
| 1149 |
This command commits an open transaction in this connection. |
| 1150 |
"," |
| 1151 |
DROP ALIAS MY_SQRT |
| 1152 |
" |
| 1153 |
|
| 1154 |
"Commands (DDL)","DROP ALL OBJECTS"," |
| 1155 |
@h2@ DROP ALL OBJECTS [ DELETE FILES ] |
| 1156 |
"," |
| 1157 |
Drops all existing views, tables, sequences, schemas, function aliases, roles, |
| 1158 |
user-defined aggregate functions, domains, and users (except the current user). |
| 1159 |
If DELETE FILES is specified, the database files will be removed when the last |
| 1160 |
user disconnects from the database. Warning: this command can not be rolled |
| 1161 |
back. |
| 1162 |
|
| 1163 |
Admin rights are required to execute this command. |
| 1164 |
"," |
| 1165 |
DROP ALL OBJECTS |
| 1166 |
" |
| 1167 |
|
| 1168 |
"Commands (DDL)","DROP CONSTANT"," |
| 1169 |
@h2@ DROP CONSTANT [ IF EXISTS ] [schemaName.]constantName |
| 1170 |
"," |
| 1171 |
Drops a constant. |
| 1172 |
Schema owner rights are required to execute this command. |
| 1173 |
This command commits an open transaction in this connection. |
| 1174 |
"," |
| 1175 |
DROP CONSTANT ONE |
| 1176 |
" |
| 1177 |
|
| 1178 |
"Commands (DDL)","DROP DOMAIN"," |
| 1179 |
DROP DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName [ RESTRICT | CASCADE ] |
| 1180 |
"," |
| 1181 |
Drops a data type (domain). |
| 1182 |
Schema owner rights are required to execute this command. |
| 1183 |
|
| 1184 |
The command will fail if it is referenced by a column or another domain (the default). |
| 1185 |
Column descriptors are replaced with original definition of specified domain if the CASCADE clause is used. |
| 1186 |
Default and on update expressions are copied into domains and columns that use this domain and don't have own |
| 1187 |
expressions. Domain constraints are copied into domains that use this domain and to columns (as check constraints) that |
| 1188 |
use this domain. |
| 1189 |
This command commits an open transaction in this connection. |
| 1190 |
"," |
| 1191 |
DROP DOMAIN EMAIL |
| 1192 |
" |
| 1193 |
|
| 1194 |
"Commands (DDL)","DROP INDEX"," |
| 1195 |
@h2@ DROP INDEX [ IF EXISTS ] [schemaName.]indexName |
| 1196 |
"," |
| 1197 |
Drops an index. |
| 1198 |
This command commits an open transaction in this connection. |
| 1199 |
"," |
| 1200 |
DROP INDEX IF EXISTS IDXNAME |
| 1201 |
" |
| 1202 |
|
| 1203 |
"Commands (DDL)","DROP ROLE"," |
| 1204 |
DROP ROLE @h2@ [ IF EXISTS ] roleName |
| 1205 |
"," |
| 1206 |
Drops a role. |
| 1207 |
Admin rights are required to execute this command. |
| 1208 |
This command commits an open transaction in this connection. |
| 1209 |
"," |
| 1210 |
DROP ROLE READONLY |
| 1211 |
" |
| 1212 |
|
| 1213 |
"Commands (DDL)","DROP SCHEMA"," |
| 1214 |
DROP SCHEMA @h2@ [ IF EXISTS ] schemaName [ RESTRICT | CASCADE ] |
| 1215 |
"," |
| 1216 |
Drops a schema. |
| 1217 |
Schema owner rights are required to execute this command. |
| 1218 |
The command will fail if objects in this schema exist and the RESTRICT clause is used (the default). |
| 1219 |
All objects in this schema are dropped as well if the CASCADE clause is used. |
| 1220 |
This command commits an open transaction in this connection. |
| 1221 |
"," |
| 1222 |
DROP SCHEMA TEST_SCHEMA |
| 1223 |
" |
| 1224 |
|
| 1225 |
"Commands (DDL)","DROP SEQUENCE"," |
| 1226 |
DROP SEQUENCE @h2@ [ IF EXISTS ] [schemaName.]sequenceName |
| 1227 |
"," |
| 1228 |
Drops a sequence. |
| 1229 |
Schema owner rights are required to execute this command. |
| 1230 |
This command commits an open transaction in this connection. |
| 1231 |
"," |
| 1232 |
DROP SEQUENCE SEQ_ID |
| 1233 |
" |
| 1234 |
|
| 1235 |
"Commands (DDL)","DROP TABLE"," |
| 1236 |
DROP TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName @h2@ [,...] |
| 1237 |
[ RESTRICT | CASCADE ] |
| 1238 |
"," |
| 1239 |
Drops an existing table, or a list of tables. |
| 1240 |
The command will fail if dependent objects exist and the RESTRICT clause is used (the default). |
| 1241 |
All dependent views and constraints are dropped as well if the CASCADE clause is used. |
| 1242 |
This command commits an open transaction in this connection. |
| 1243 |
"," |
| 1244 |
DROP TABLE TEST |
| 1245 |
" |
| 1246 |
|
| 1247 |
"Commands (DDL)","DROP TRIGGER"," |
| 1248 |
DROP TRIGGER @h2@ [ IF EXISTS ] [schemaName.]triggerName |
| 1249 |
"," |
| 1250 |
Drops an existing trigger. |
| 1251 |
This command commits an open transaction in this connection. |
| 1252 |
"," |
| 1253 |
DROP TRIGGER TRIG_INS |
| 1254 |
" |
| 1255 |
|
| 1256 |
"Commands (DDL)","DROP USER"," |
| 1257 |
@h2@ DROP USER [ IF EXISTS ] userName |
| 1258 |
"," |
| 1259 |
Drops a user. The current user cannot be dropped. |
| 1260 |
For compatibility, only unquoted or uppercase user names are allowed. |
| 1261 |
|
| 1262 |
Admin rights are required to execute this command. |
| 1263 |
This command commits an open transaction in this connection. |
| 1264 |
"," |
| 1265 |
DROP USER TOM |
| 1266 |
" |
| 1267 |
|
| 1268 |
"Commands (DDL)","DROP VIEW"," |
| 1269 |
DROP VIEW @h2@ [ IF EXISTS ] [schemaName.]viewName [ RESTRICT | CASCADE ] |
| 1270 |
"," |
| 1271 |
Drops an existing view. |
| 1272 |
Schema owner rights are required to execute this command. |
| 1273 |
All dependent views are dropped as well if the CASCADE clause is used (the default). |
| 1274 |
The command will fail if dependent views exist and the RESTRICT clause is used. |
| 1275 |
This command commits an open transaction in this connection. |
| 1276 |
"," |
| 1277 |
DROP VIEW TEST_VIEW |
| 1278 |
" |
| 1279 |
|
| 1280 |
"Commands (DDL)","DROP MATERIALIZED VIEW"," |
| 1281 |
@h2@ DROP MATERIALIZED VIEW [ IF EXISTS ] [schemaName.]viewName |
| 1282 |
"," |
| 1283 |
Drops an existing materialized view. |
| 1284 |
Schema owner rights are required to execute this command. |
| 1285 |
This command commits an open transaction in this connection. |
| 1286 |
"," |
| 1287 |
DROP MATERIALIZED VIEW TEST_VIEW |
| 1288 |
" |
| 1289 |
|
| 1290 |
"Commands (DDL)","REFRESH MATERIALIZED VIEW"," |
| 1291 |
@h2@ REFRESH MATERIALIZED VIEW [ IF EXISTS ] [schemaName.]viewName |
| 1292 |
"," |
| 1293 |
Recreates an existing materialized view. |
| 1294 |
Schema owner rights are required to execute this command. |
| 1295 |
This command commits an open transaction in this connection. |
| 1296 |
"," |
| 1297 |
REFRESH MATERIALIZED VIEW TEST_VIEW |
| 1298 |
" |
| 1299 |
|
| 1300 |
"Commands (DDL)","TRUNCATE TABLE"," |
| 1301 |
TRUNCATE TABLE [schemaName.]tableName [ [ CONTINUE | RESTART ] IDENTITY ] |
| 1302 |
"," |
| 1303 |
Removes all rows from a table. |
| 1304 |
Unlike DELETE FROM without where clause, this command can not be rolled back. |
| 1305 |
This command is faster than DELETE without where clause. |
| 1306 |
Only regular data tables without foreign key constraints can be truncated |
| 1307 |
(except if referential integrity is disabled for this database or for this table). |
| 1308 |
Linked tables can't be truncated. |
| 1309 |
If RESTART IDENTITY is specified next values for identity columns are restarted. |
| 1310 |
|
| 1311 |
This command commits an open transaction in this connection. |
| 1312 |
"," |
| 1313 |
TRUNCATE TABLE TEST |
| 1314 |
" |
| 1315 |
|
| 1316 |
"Commands (Other)","CHECKPOINT"," |
| 1317 |
@h2@ CHECKPOINT |
| 1318 |
"," |
| 1319 |
Flushes the data to disk. |
| 1320 |
|
| 1321 |
Admin rights are required to execute this command. |
| 1322 |
"," |
| 1323 |
CHECKPOINT |
| 1324 |
" |
| 1325 |
|
| 1326 |
"Commands (Other)","CHECKPOINT SYNC"," |
| 1327 |
@h2@ CHECKPOINT SYNC |
| 1328 |
"," |
| 1329 |
Flushes the data to disk and forces all system buffers be written |
| 1330 |
to the underlying device. |
| 1331 |
|
| 1332 |
Admin rights are required to execute this command. |
| 1333 |
"," |
| 1334 |
CHECKPOINT SYNC |
| 1335 |
" |
| 1336 |
|
| 1337 |
"Commands (Other)","COMMIT"," |
| 1338 |
COMMIT [ WORK ] |
| 1339 |
"," |
| 1340 |
Commits a transaction. |
| 1341 |
"," |
| 1342 |
COMMIT |
| 1343 |
" |
| 1344 |
|
| 1345 |
"Commands (Other)","COMMIT TRANSACTION"," |
| 1346 |
@h2@ COMMIT TRANSACTION transactionName |
| 1347 |
"," |
| 1348 |
Sets the resolution of an in-doubt transaction to 'commit'. |
| 1349 |
|
| 1350 |
Admin rights are required to execute this command. |
| 1351 |
This command is part of the 2-phase-commit protocol. |
| 1352 |
"," |
| 1353 |
COMMIT TRANSACTION XID_TEST |
| 1354 |
" |
| 1355 |
|
| 1356 |
"Commands (Other)","GRANT RIGHT"," |
| 1357 |
GRANT { { SELECT | INSERT | UPDATE | DELETE } [,..] | ALL [ PRIVILEGES ] } ON |
| 1358 |
{ @h2@ { SCHEMA schemaName } | { [ TABLE ] [schemaName.]tableName @h2@ [,...] } } |
| 1359 |
TO { PUBLIC | userName | roleName } |
| 1360 |
"," |
| 1361 |
Grants rights for a table to a user or role. |
| 1362 |
|
| 1363 |
Schema owner rights are required to execute this command. |
| 1364 |
This command commits an open transaction in this connection. |
| 1365 |
"," |
| 1366 |
GRANT SELECT ON TEST TO READONLY |
| 1367 |
" |
| 1368 |
|
| 1369 |
"Commands (Other)","GRANT ALTER ANY SCHEMA"," |
| 1370 |
@h2@ GRANT ALTER ANY SCHEMA TO userName |
| 1371 |
"," |
| 1372 |
Grant schema admin rights to a user. |
| 1373 |
|
| 1374 |
Schema admin can create, rename, or drop schemas and also has schema owner rights in every schema. |
| 1375 |
|
| 1376 |
Admin rights are required to execute this command. |
| 1377 |
This command commits an open transaction in this connection. |
| 1378 |
"," |
| 1379 |
GRANT ALTER ANY SCHEMA TO Bob |
| 1380 |
" |
| 1381 |
|
| 1382 |
"Commands (Other)","GRANT ROLE"," |
| 1383 |
GRANT { roleName [,...] } TO { PUBLIC | userName | roleName } |
| 1384 |
"," |
| 1385 |
Grants a role to a user or role. |
| 1386 |
|
| 1387 |
Admin rights are required to execute this command. |
| 1388 |
This command commits an open transaction in this connection. |
| 1389 |
"," |
| 1390 |
GRANT READONLY TO PUBLIC |
| 1391 |
" |
| 1392 |
|
| 1393 |
"Commands (Other)","HELP"," |
| 1394 |
@h2@ HELP [ anything [...] ] |
| 1395 |
"," |
| 1396 |
Displays the help pages of SQL commands or keywords. |
| 1397 |
"," |
| 1398 |
HELP SELECT |
| 1399 |
" |
| 1400 |
|
| 1401 |
"Commands (Other)","PREPARE COMMIT"," |
| 1402 |
@h2@ PREPARE COMMIT newTransactionName |
| 1403 |
"," |
| 1404 |
Prepares committing a transaction. |
| 1405 |
This command is part of the 2-phase-commit protocol. |
| 1406 |
"," |
| 1407 |
PREPARE COMMIT XID_TEST |
| 1408 |
" |
| 1409 |
|
| 1410 |
"Commands (Other)","REVOKE RIGHT"," |
| 1411 |
REVOKE { { SELECT | INSERT | UPDATE | DELETE } [,..] | ALL [ PRIVILEGES ] } ON |
| 1412 |
{ @h2@ { SCHEMA schemaName } | { [ TABLE ] [schemaName.]tableName @h2@ [,...] } } |
| 1413 |
FROM { PUBLIC | userName | roleName } |
| 1414 |
"," |
| 1415 |
Removes rights for a table from a user or role. |
| 1416 |
|
| 1417 |
Schema owner rights are required to execute this command. |
| 1418 |
This command commits an open transaction in this connection. |
| 1419 |
"," |
| 1420 |
REVOKE SELECT ON TEST FROM READONLY |
| 1421 |
" |
| 1422 |
|
| 1423 |
"Commands (Other)","REVOKE ALTER ANY SCHEMA"," |
| 1424 |
@h2@ REVOKE ALTER ANY SCHEMA FROM userName |
| 1425 |
"," |
| 1426 |
Removes schema admin rights from a user. |
| 1427 |
|
| 1428 |
Admin rights are required to execute this command. |
| 1429 |
This command commits an open transaction in this connection. |
| 1430 |
"," |
| 1431 |
GRANT ALTER ANY SCHEMA TO Bob |
| 1432 |
" |
| 1433 |
|
| 1434 |
"Commands (Other)","REVOKE ROLE"," |
| 1435 |
REVOKE { roleName [,...] } FROM { PUBLIC | userName | roleName } |
| 1436 |
"," |
| 1437 |
Removes a role from a user or role. |
| 1438 |
|
| 1439 |
Admin rights are required to execute this command. |
| 1440 |
This command commits an open transaction in this connection. |
| 1441 |
"," |
| 1442 |
REVOKE READONLY FROM TOM |
| 1443 |
" |
| 1444 |
|
| 1445 |
"Commands (Other)","ROLLBACK"," |
| 1446 |
ROLLBACK [ WORK ] [ TO SAVEPOINT savepointName ] |
| 1447 |
"," |
| 1448 |
Rolls back a transaction. If a savepoint name is used, the transaction is only |
| 1449 |
rolled back to the specified savepoint. |
| 1450 |
"," |
| 1451 |
ROLLBACK |
| 1452 |
" |
| 1453 |
|
| 1454 |
"Commands (Other)","ROLLBACK TRANSACTION"," |
| 1455 |
@h2@ ROLLBACK TRANSACTION transactionName |
| 1456 |
"," |
| 1457 |
Sets the resolution of an in-doubt transaction to 'rollback'. |
| 1458 |
|
| 1459 |
Admin rights are required to execute this command. |
| 1460 |
This command is part of the 2-phase-commit protocol. |
| 1461 |
"," |
| 1462 |
ROLLBACK TRANSACTION XID_TEST |
| 1463 |
" |
| 1464 |
|
| 1465 |
"Commands (Other)","SAVEPOINT"," |
| 1466 |
SAVEPOINT savepointName |
| 1467 |
"," |
| 1468 |
Create a new savepoint. See also ROLLBACK. |
| 1469 |
Savepoints are only valid until the transaction is committed or rolled back. |
| 1470 |
"," |
| 1471 |
SAVEPOINT HALF_DONE |
| 1472 |
" |
| 1473 |
|
| 1474 |
"Commands (Other)","SET @"," |
| 1475 |
@h2@ SET @variableName [ = ] expression |
| 1476 |
"," |
| 1477 |
Updates a user-defined variable. |
| 1478 |
Variables are not persisted and session scoped, that means only visible from within the session in which they are defined. |
| 1479 |
This command does not commit a transaction, and rollback does not affect it. |
| 1480 |
"," |
| 1481 |
SET @TOTAL=0 |
| 1482 |
" |
| 1483 |
|
| 1484 |
"Commands (Other)","SET ALLOW_LITERALS"," |
| 1485 |
@h2@ SET ALLOW_LITERALS { NONE | ALL | NUMBERS } |
| 1486 |
"," |
| 1487 |
This setting can help solve the SQL injection problem. By default, text and |
| 1488 |
number literals are allowed in SQL statements. However, this enables SQL |
| 1489 |
injection if the application dynamically builds SQL statements. SQL injection is |
| 1490 |
not possible if user data is set using parameters ('?'). |
| 1491 |
|
| 1492 |
NONE means literals of any kind are not allowed, only parameters and constants |
| 1493 |
are allowed. NUMBERS mean only numerical and boolean literals are allowed. ALL |
| 1494 |
means all literals are allowed (default). |
| 1495 |
|
| 1496 |
See also CREATE CONSTANT. |
| 1497 |
|
| 1498 |
Admin rights are required to execute this command, as it affects all connections. |
| 1499 |
This command commits an open transaction in this connection. |
| 1500 |
This setting is persistent. |
| 1501 |
This setting can be appended to the database URL: ""jdbc:h2:./test;ALLOW_LITERALS=NONE"" |
| 1502 |
"," |
| 1503 |
SET ALLOW_LITERALS NONE |
| 1504 |
" |
| 1505 |
|
| 1506 |
"Commands (Other)","SET AUTOCOMMIT"," |
| 1507 |
@h2@ SET AUTOCOMMIT { TRUE | ON | FALSE | OFF } |
| 1508 |
"," |
| 1509 |
Switches auto commit on or off. |
| 1510 |
This setting can be appended to the database URL: ""jdbc:h2:./test;AUTOCOMMIT=OFF"" - |
| 1511 |
however this will not work as expected when using a connection pool |
| 1512 |
(the connection pool manager will re-enable autocommit when returning |
| 1513 |
the connection to the pool, so autocommit will only be disabled the first |
| 1514 |
time the connection is used. |
| 1515 |
"," |
| 1516 |
SET AUTOCOMMIT OFF |
| 1517 |
" |
| 1518 |
|
| 1519 |
"Commands (Other)","SET CACHE_SIZE"," |
| 1520 |
@h2@ SET CACHE_SIZE int |
| 1521 |
"," |
| 1522 |
Sets the size of the cache in KB (each KB being 1024 bytes) for the current database. |
| 1523 |
The default is 65536 per available GB of RAM, i.e. 64 MB per GB. |
| 1524 |
The value is rounded to the next higher power of two. |
| 1525 |
Depending on the virtual machine, the actual memory required may be higher. |
| 1526 |
|
| 1527 |
This setting is persistent and affects all connections as there is only one cache per database. |
| 1528 |
Using a very small value (specially 0) will reduce performance a lot. |
| 1529 |
This setting only affects the database engine (the server in a client/server environment; |
| 1530 |
in embedded mode, the database engine is in the same process as the application). |
| 1531 |
It has no effect for in-memory databases. |
| 1532 |
|
| 1533 |
Admin rights are required to execute this command, as it affects all connections. |
| 1534 |
This command commits an open transaction in this connection. |
| 1535 |
This setting is persistent. |
| 1536 |
This setting can be appended to the database URL: ""jdbc:h2:./test;CACHE_SIZE=8192"" |
| 1537 |
"," |
| 1538 |
SET CACHE_SIZE 8192 |
| 1539 |
" |
| 1540 |
|
| 1541 |
"Commands (Other)","SET CLUSTER"," |
| 1542 |
@h2@ SET CLUSTER serverListString |
| 1543 |
"," |
| 1544 |
This command should not be used directly by an application, the statement is |
| 1545 |
executed automatically by the system. The behavior may change in future |
| 1546 |
releases. Sets the cluster server list. An empty string switches off the cluster |
| 1547 |
mode. Switching on the cluster mode requires admin rights, but any user can |
| 1548 |
switch it off (this is automatically done when the client detects the other |
| 1549 |
server is not responding). |
| 1550 |
|
| 1551 |
This command is effective immediately, but does not commit an open transaction. |
| 1552 |
"," |
| 1553 |
SET CLUSTER '' |
| 1554 |
" |
| 1555 |
|
| 1556 |
"Commands (Other)","SET BUILTIN_ALIAS_OVERRIDE"," |
| 1557 |
@h2@ SET BUILTIN_ALIAS_OVERRIDE { TRUE | FALSE } |
| 1558 |
"," |
| 1559 |
Allows the overriding of the builtin system date/time functions |
| 1560 |
for unit testing purposes. |
| 1561 |
|
| 1562 |
Admin rights are required to execute this command. |
| 1563 |
This command commits an open transaction in this connection. |
| 1564 |
"," |
| 1565 |
SET BUILTIN_ALIAS_OVERRIDE TRUE |
| 1566 |
" |
| 1567 |
|
| 1568 |
"Commands (Other)","SET CATALOG"," |
| 1569 |
SET CATALOG { catalogString | @h2@ { catalogName } } |
| 1570 |
"," |
| 1571 |
This command has no effect if the specified name matches the name of the database, otherwise it throws an exception. |
| 1572 |
|
| 1573 |
This command does not commit a transaction. |
| 1574 |
"," |
| 1575 |
SET CATALOG 'DB' |
| 1576 |
SET CATALOG DB_NAME |
| 1577 |
" |
| 1578 |
|
| 1579 |
"Commands (Other)","SET COLLATION"," |
| 1580 |
@h2@ SET [ DATABASE ] COLLATION |
| 1581 |
@h2@ { OFF | collationName |
| 1582 |
[ STRENGTH { PRIMARY | SECONDARY | TERTIARY | IDENTICAL } ] } |
| 1583 |
"," |
| 1584 |
Sets the collation used for comparing strings. |
| 1585 |
This command can only be executed if there are no tables defined. |
| 1586 |
See ""java.text.Collator"" for details about the supported collations and the STRENGTH |
| 1587 |
(PRIMARY is usually case- and umlaut-insensitive; SECONDARY is case-insensitive but umlaut-sensitive; |
| 1588 |
TERTIARY is both case- and umlaut-sensitive; IDENTICAL is sensitive to all differences and only affects ordering). |
| 1589 |
|
| 1590 |
The ICU4J collator is used if it is in the classpath. |
| 1591 |
It is also used if the collation name starts with ICU4J_ |
| 1592 |
(in that case, the ICU4J must be in the classpath, otherwise an exception is thrown). |
| 1593 |
The default collator is used if the collation name starts with DEFAULT_ |
| 1594 |
(even if ICU4J is in the classpath). |
| 1595 |
The charset collator is used if the collation name starts with CHARSET_ (e.g. CHARSET_CP500). This collator sorts |
| 1596 |
strings according to the binary representation in the given charset. |
| 1597 |
|
| 1598 |
Admin rights are required to execute this command. |
| 1599 |
This command commits an open transaction in this connection. |
| 1600 |
This setting is persistent. |
| 1601 |
This setting can be appended to the database URL: ""jdbc:h2:./test;COLLATION='ENGLISH'"" |
| 1602 |
"," |
| 1603 |
SET COLLATION ENGLISH |
| 1604 |
SET COLLATION CHARSET_CP500 |
| 1605 |
" |
| 1606 |
|
| 1607 |
"Commands (Other)","SET DATABASE_EVENT_LISTENER"," |
| 1608 |
@h2@ SET DATABASE_EVENT_LISTENER classNameString |
| 1609 |
"," |
| 1610 |
Sets the event listener class. An empty string ('') means no listener should be |
| 1611 |
used. This setting is not persistent. |
| 1612 |
|
| 1613 |
Admin rights are required to execute this command, except if it is set when |
| 1614 |
opening the database (in this case it is reset just after opening the database). |
| 1615 |
This setting can be appended to the database URL: ""jdbc:h2:./test;DATABASE_EVENT_LISTENER='sample.MyListener'"" |
| 1616 |
"," |
| 1617 |
SET DATABASE_EVENT_LISTENER 'sample.MyListener' |
| 1618 |
" |
| 1619 |
|
| 1620 |
"Commands (Other)","SET DB_CLOSE_DELAY"," |
| 1621 |
@h2@ SET DB_CLOSE_DELAY int |
| 1622 |
"," |
| 1623 |
Sets the delay for closing a database if all connections are closed. |
| 1624 |
The value -1 means the database is never closed until the close delay is set to some other value or SHUTDOWN is called. |
| 1625 |
The value 0 means no delay (default; the database is closed if the last connection to it is closed). |
| 1626 |
Values 1 and larger mean the number of seconds the database is left open after closing the last connection. |
| 1627 |
|
| 1628 |
If the application exits normally or System.exit is called, the database is closed immediately, even if a delay is set. |
| 1629 |
|
| 1630 |
Admin rights are required to execute this command, as it affects all connections. |
| 1631 |
This command commits an open transaction in this connection. |
| 1632 |
This setting is persistent. |
| 1633 |
This setting can be appended to the database URL: ""jdbc:h2:./test;DB_CLOSE_DELAY=-1"" |
| 1634 |
"," |
| 1635 |
SET DB_CLOSE_DELAY -1 |
| 1636 |
" |
| 1637 |
|
| 1638 |
"Commands (Other)","SET DEFAULT_LOCK_TIMEOUT"," |
| 1639 |
@h2@ SET DEFAULT LOCK_TIMEOUT int |
| 1640 |
"," |
| 1641 |
Sets the default lock timeout (in milliseconds) in this database that is used |
| 1642 |
for the new sessions. The default value for this setting is 1000 (one second). |
| 1643 |
|
| 1644 |
Admin rights are required to execute this command, as it affects all connections. |
| 1645 |
This command commits an open transaction in this connection. |
| 1646 |
This setting is persistent. |
| 1647 |
"," |
| 1648 |
SET DEFAULT_LOCK_TIMEOUT 5000 |
| 1649 |
" |
| 1650 |
|
| 1651 |
"Commands (Other)","SET DEFAULT_NULL_ORDERING"," |
| 1652 |
@h2@ SET DEFAULT_NULL_ORDERING { LOW | HIGH | FIRST | LAST } |
| 1653 |
"," |
| 1654 |
Changes the default ordering of NULL values. |
| 1655 |
This setting affects new indexes without explicit NULLS FIRST or NULLS LAST columns, |
| 1656 |
and ordering clauses of other commands without explicit null ordering. |
| 1657 |
This setting doesn't affect ordering of NULL values inside ARRAY or ROW values |
| 1658 |
(""ARRAY[NULL]"" is always considered as smaller than ""ARRAY[1]"" during sorting). |
| 1659 |
|
| 1660 |
LOW is the default one, NULL values are considered as smaller than other values during sorting. |
| 1661 |
|
| 1662 |
With HIGH default ordering NULL values are considered as larger than other values during sorting. |
| 1663 |
|
| 1664 |
With FIRST default ordering NULL values are sorted before other values, |
| 1665 |
no matter if ascending or descending order is used. |
| 1666 |
|
| 1667 |
WITH LAST default ordering NULL values are sorted after other values, |
| 1668 |
no matter if ascending or descending order is used. |
| 1669 |
|
| 1670 |
This setting is not persistent, but indexes are persisted with explicit NULLS FIRST or NULLS LAST ordering |
| 1671 |
and aren't affected by changes in this setting. |
| 1672 |
Admin rights are required to execute this command, as it affects all connections. |
| 1673 |
This command commits an open transaction in this connection. |
| 1674 |
This setting can be appended to the database URL: ""jdbc:h2:./test;DEFAULT_NULL_ORDERING=HIGH"" |
| 1675 |
"," |
| 1676 |
SET DEFAULT_NULL_ORDERING HIGH |
| 1677 |
" |
| 1678 |
|
| 1679 |
"Commands (Other)","SET DEFAULT_TABLE_TYPE"," |
| 1680 |
@h2@ SET DEFAULT_TABLE_TYPE { MEMORY | CACHED } |
| 1681 |
"," |
| 1682 |
Sets the default table storage type that is used when creating new tables. |
| 1683 |
Memory tables are kept fully in the main memory (including indexes), however |
| 1684 |
the data is still stored in the database file. The size of memory tables is |
| 1685 |
limited by the memory. The default is CACHED. |
| 1686 |
|
| 1687 |
Admin rights are required to execute this command, as it affects all connections. |
| 1688 |
This command commits an open transaction in this connection. |
| 1689 |
This setting is persistent. |
| 1690 |
It has no effect for in-memory databases. |
| 1691 |
"," |
| 1692 |
SET DEFAULT_TABLE_TYPE MEMORY |
| 1693 |
" |
| 1694 |
|
| 1695 |
"Commands (Other)","SET EXCLUSIVE"," |
| 1696 |
@h2@ SET EXCLUSIVE { 0 | 1 | 2 } |
| 1697 |
"," |
| 1698 |
Switched the database to exclusive mode (1, 2) and back to normal mode (0). |
| 1699 |
|
| 1700 |
In exclusive mode, new connections are rejected, and operations by |
| 1701 |
other connections are paused until the exclusive mode is disabled. |
| 1702 |
When using the value 1, existing connections stay open. |
| 1703 |
When using the value 2, all existing connections are closed |
| 1704 |
(and current transactions are rolled back) except the connection |
| 1705 |
that executes SET EXCLUSIVE. |
| 1706 |
Only the connection that set the exclusive mode can disable it. |
| 1707 |
When the connection is closed, it is automatically disabled. |
| 1708 |
|
| 1709 |
Admin rights are required to execute this command. |
| 1710 |
This command commits an open transaction in this connection. |
| 1711 |
"," |
| 1712 |
SET EXCLUSIVE 1 |
| 1713 |
" |
| 1714 |
|
| 1715 |
"Commands (Other)","SET IGNORECASE"," |
| 1716 |
@h2@ SET IGNORECASE { TRUE | FALSE } |
| 1717 |
"," |
| 1718 |
If IGNORECASE is enabled, text columns in newly created tables will be |
| 1719 |
case-insensitive. Already existing tables are not affected. The effect of |
| 1720 |
case-insensitive columns is similar to using a collation with strength PRIMARY. |
| 1721 |
Case-insensitive columns are compared faster than when using a collation. |
| 1722 |
String literals and parameters are however still considered case sensitive even if this option is set. |
| 1723 |
|
| 1724 |
Admin rights are required to execute this command, as it affects all connections. |
| 1725 |
This command commits an open transaction in this connection. |
| 1726 |
This setting is persistent. |
| 1727 |
This setting can be appended to the database URL: ""jdbc:h2:./test;IGNORECASE=TRUE"" |
| 1728 |
"," |
| 1729 |
SET IGNORECASE TRUE |
| 1730 |
" |
| 1731 |
|
| 1732 |
"Commands (Other)","SET IGNORE_CATALOGS"," |
| 1733 |
@c@ SET IGNORE_CATALOGS { TRUE | FALSE } |
| 1734 |
"," |
| 1735 |
If IGNORE_CATALOGS is enabled, catalog names in front of schema names will be ignored. This can be used if |
| 1736 |
multiple catalogs used by the same connections must be simulated. Caveat: if both catalogs contain schemas of the |
| 1737 |
same name and if those schemas contain objects of the same name, this will lead to errors, when trying to manage, |
| 1738 |
access or change these objects. |
| 1739 |
This setting can be appended to the database URL: ""jdbc:h2:./test;IGNORE_CATALOGS=TRUE"" |
| 1740 |
"," |
| 1741 |
SET IGNORE_CATALOGS TRUE |
| 1742 |
" |
| 1743 |
|
| 1744 |
"Commands (Other)","SET JAVA_OBJECT_SERIALIZER"," |
| 1745 |
@h2@ SET JAVA_OBJECT_SERIALIZER { null | className } |
| 1746 |
"," |
| 1747 |
Sets the object used to serialize and deserialize java objects being stored in column of type OTHER. |
| 1748 |
The serializer class must be public and implement ""org.h2.api.JavaObjectSerializer"". |
| 1749 |
Inner classes are not supported. |
| 1750 |
The class must be available in the classpath of the database engine |
| 1751 |
(when using the server mode, it must be both in the classpath of the server and the client). |
| 1752 |
This command can only be executed if there are no tables defined. |
| 1753 |
|
| 1754 |
Admin rights are required to execute this command. |
| 1755 |
This command commits an open transaction in this connection. |
| 1756 |
This setting is persistent. |
| 1757 |
This setting can be appended to the database URL: ""jdbc:h2:./test;JAVA_OBJECT_SERIALIZER='com.acme.SerializerClassName'"" |
| 1758 |
"," |
| 1759 |
SET JAVA_OBJECT_SERIALIZER 'com.acme.SerializerClassName' |
| 1760 |
" |
| 1761 |
|
| 1762 |
"Commands (Other)","SET LAZY_QUERY_EXECUTION"," |
| 1763 |
@h2@ SET LAZY_QUERY_EXECUTION int |
| 1764 |
"," |
| 1765 |
Sets the lazy query execution mode. The values 0, 1 are supported. |
| 1766 |
|
| 1767 |
If true, then large results are retrieved in chunks. |
| 1768 |
|
| 1769 |
Note that not all queries support this feature, queries which do not are processed normally. |
| 1770 |
|
| 1771 |
This command does not commit a transaction, and rollback does not affect it. |
| 1772 |
This setting can be appended to the database URL: ""jdbc:h2:./test;LAZY_QUERY_EXECUTION=1"" |
| 1773 |
"," |
| 1774 |
SET LAZY_QUERY_EXECUTION 1 |
| 1775 |
" |
| 1776 |
|
| 1777 |
"Commands (Other)","SET LOCK_MODE"," |
| 1778 |
@h2@ SET LOCK_MODE int |
| 1779 |
"," |
| 1780 |
Sets the lock mode. The values 0, 1, 2, and 3 are supported. The default is 3. |
| 1781 |
This setting affects all connections. |
| 1782 |
|
| 1783 |
The value 0 means no locking (should only be used for testing). |
| 1784 |
Please note that using SET LOCK_MODE 0 while at the same time |
| 1785 |
using multiple connections may result in inconsistent transactions. |
| 1786 |
|
| 1787 |
The value 3 means row-level locking for write operations. |
| 1788 |
|
| 1789 |
The values 1 and 2 have the same effect as 3. |
| 1790 |
|
| 1791 |
Admin rights are required to execute this command, as it affects all connections. |
| 1792 |
This command commits an open transaction in this connection. |
| 1793 |
This setting is persistent. |
| 1794 |
This setting can be appended to the database URL: ""jdbc:h2:./test;LOCK_MODE=0"" |
| 1795 |
"," |
| 1796 |
SET LOCK_MODE 0 |
| 1797 |
" |
| 1798 |
|
| 1799 |
"Commands (Other)","SET LOCK_TIMEOUT"," |
| 1800 |
@h2@ SET LOCK_TIMEOUT int |
| 1801 |
"," |
| 1802 |
Sets the lock timeout (in milliseconds) for the current session. The default |
| 1803 |
value for this setting is 1000 (one second). |
| 1804 |
|
| 1805 |
This command does not commit a transaction, and rollback does not affect it. |
| 1806 |
This setting can be appended to the database URL: ""jdbc:h2:./test;LOCK_TIMEOUT=10000"" |
| 1807 |
"," |
| 1808 |
SET LOCK_TIMEOUT 1000 |
| 1809 |
" |
| 1810 |
|
| 1811 |
"Commands (Other)","SET MAX_LENGTH_INPLACE_LOB"," |
| 1812 |
@h2@ SET MAX_LENGTH_INPLACE_LOB int |
| 1813 |
"," |
| 1814 |
Sets the maximum size of an in-place LOB object. |
| 1815 |
|
| 1816 |
This is the maximum length of an LOB that is stored with the record itself, |
| 1817 |
and the default value is 256. |
| 1818 |
|
| 1819 |
Admin rights are required to execute this command, as it affects all connections. |
| 1820 |
This command commits an open transaction in this connection. |
| 1821 |
This setting is persistent. |
| 1822 |
"," |
| 1823 |
SET MAX_LENGTH_INPLACE_LOB 128 |
| 1824 |
" |
| 1825 |
|
| 1826 |
"Commands (Other)","SET MAX_LOG_SIZE"," |
| 1827 |
@h2@ SET MAX_LOG_SIZE int |
| 1828 |
"," |
| 1829 |
Sets the maximum size of the transaction log, in megabytes. |
| 1830 |
If the log is larger, and if there is no open transaction, the transaction log is truncated. |
| 1831 |
If there is an open transaction, the transaction log will continue to grow however. |
| 1832 |
The default max size is 16 MB. |
| 1833 |
This setting has no effect for in-memory databases. |
| 1834 |
|
| 1835 |
Admin rights are required to execute this command, as it affects all connections. |
| 1836 |
This command commits an open transaction in this connection. |
| 1837 |
This setting is persistent. |
| 1838 |
"," |
| 1839 |
SET MAX_LOG_SIZE 2 |
| 1840 |
" |
| 1841 |
|
| 1842 |
"Commands (Other)","SET MAX_MEMORY_ROWS"," |
| 1843 |
@h2@ SET MAX_MEMORY_ROWS int |
| 1844 |
"," |
| 1845 |
The maximum number of rows in a result set that are kept in-memory. If more rows |
| 1846 |
are read, then the rows are buffered to disk. |
| 1847 |
The default is 40000 per GB of available RAM. |
| 1848 |
|
| 1849 |
Admin rights are required to execute this command, as it affects all connections. |
| 1850 |
This command commits an open transaction in this connection. |
| 1851 |
This setting is persistent. |
| 1852 |
It has no effect for in-memory databases. |
| 1853 |
"," |
| 1854 |
SET MAX_MEMORY_ROWS 1000 |
| 1855 |
" |
| 1856 |
|
| 1857 |
"Commands (Other)","SET MAX_MEMORY_UNDO"," |
| 1858 |
@h2@ SET MAX_MEMORY_UNDO int |
| 1859 |
"," |
| 1860 |
The maximum number of undo records per a session that are kept in-memory. |
| 1861 |
If a transaction is larger, the records are buffered to disk. |
| 1862 |
The default value is 50000. |
| 1863 |
Changes to tables without a primary key can not be buffered to disk. |
| 1864 |
This setting is not supported when using multi-version concurrency. |
| 1865 |
|
| 1866 |
Admin rights are required to execute this command, as it affects all connections. |
| 1867 |
This command commits an open transaction in this connection. |
| 1868 |
This setting is persistent. |
| 1869 |
It has no effect for in-memory databases. |
| 1870 |
"," |
| 1871 |
SET MAX_MEMORY_UNDO 1000 |
| 1872 |
" |
| 1873 |
|
| 1874 |
"Commands (Other)","SET MAX_OPERATION_MEMORY"," |
| 1875 |
@h2@ SET MAX_OPERATION_MEMORY int |
| 1876 |
"," |
| 1877 |
Sets the maximum memory used for large operations (delete and insert), in bytes. |
| 1878 |
Operations that use more memory are buffered to disk, slowing down the |
| 1879 |
operation. The default max size is 100000. 0 means no limit. |
| 1880 |
|
| 1881 |
This setting is not persistent. |
| 1882 |
Admin rights are required to execute this command, as it affects all connections. |
| 1883 |
It has no effect for in-memory databases. |
| 1884 |
This setting can be appended to the database URL: ""jdbc:h2:./test;MAX_OPERATION_MEMORY=10000"" |
| 1885 |
"," |
| 1886 |
SET MAX_OPERATION_MEMORY 0 |
| 1887 |
" |
| 1888 |
|
| 1889 |
"Commands (Other)","SET MODE"," |
| 1890 |
@h2@ SET MODE { REGULAR | STRICT | LEGACY | DB2 | DERBY | HSQLDB | MSSQLSERVER | MYSQL | ORACLE | POSTGRESQL } |
| 1891 |
"," |
| 1892 |
Changes to another database compatibility mode. For details, see |
| 1893 |
[Compatibility Modes](https://h2database.com/html/features.html#compatibility_modes). |
| 1894 |
|
| 1895 |
This setting is not persistent. |
| 1896 |
Admin rights are required to execute this command, as it affects all connections. |
| 1897 |
This command commits an open transaction in this connection. |
| 1898 |
This setting can be appended to the database URL: ""jdbc:h2:./test;MODE=MYSQL"" |
| 1899 |
"," |
| 1900 |
SET MODE HSQLDB |
| 1901 |
" |
| 1902 |
|
| 1903 |
"Commands (Other)","SET NON_KEYWORDS"," |
| 1904 |
@h2@ SET NON_KEYWORDS [ name [,...] ] |
| 1905 |
"," |
| 1906 |
Converts the specified tokens from keywords to plain identifiers for the current session. |
| 1907 |
This setting may break some commands and should be used with caution and only when necessary. |
| 1908 |
Use [quoted identifiers](https://h2database.com/html/grammar.html#quoted_name) instead of this setting if possible. |
| 1909 |
|
| 1910 |
This command does not commit a transaction, and rollback does not affect it. |
| 1911 |
This setting can be appended to the database URL: ""jdbc:h2:./test;NON_KEYWORDS=KEY,VALUE"" |
| 1912 |
"," |
| 1913 |
SET NON_KEYWORDS KEY, VALUE |
| 1914 |
" |
| 1915 |
|
| 1916 |
"Commands (Other)","SET OPTIMIZE_REUSE_RESULTS"," |
| 1917 |
@h2@ SET OPTIMIZE_REUSE_RESULTS { 0 | 1 } |
| 1918 |
"," |
| 1919 |
Enabled (1) or disabled (0) the result reuse optimization. If enabled, |
| 1920 |
subqueries and views used as subqueries are only re-run if the data in one of |
| 1921 |
the tables was changed. This option is enabled by default. |
| 1922 |
|
| 1923 |
Admin rights are required to execute this command, as it affects all connections. |
| 1924 |
This command commits an open transaction in this connection. |
| 1925 |
This setting can be appended to the database URL: ""jdbc:h2:./test;OPTIMIZE_REUSE_RESULTS=0"" |
| 1926 |
"," |
| 1927 |
SET OPTIMIZE_REUSE_RESULTS 0 |
| 1928 |
" |
| 1929 |
|
| 1930 |
"Commands (Other)","SET PASSWORD"," |
| 1931 |
@h2@ SET PASSWORD string |
| 1932 |
"," |
| 1933 |
Changes the password of the current user. The password must be in single quotes. |
| 1934 |
It is case sensitive and can contain spaces. |
| 1935 |
|
| 1936 |
This command commits an open transaction in this connection. |
| 1937 |
"," |
| 1938 |
SET PASSWORD 'abcstzri!.5' |
| 1939 |
" |
| 1940 |
|
| 1941 |
"Commands (Other)","SET QUERY_STATISTICS"," |
| 1942 |
@h2@ SET QUERY_STATISTICS { TRUE | FALSE } |
| 1943 |
"," |
| 1944 |
Disabled or enables query statistics gathering for the whole database. |
| 1945 |
The statistics are reflected in the INFORMATION_SCHEMA.QUERY_STATISTICS meta-table. |
| 1946 |
|
| 1947 |
This setting is not persistent. |
| 1948 |
This command commits an open transaction in this connection. |
| 1949 |
Admin rights are required to execute this command, as it affects all connections. |
| 1950 |
"," |
| 1951 |
SET QUERY_STATISTICS FALSE |
| 1952 |
" |
| 1953 |
|
| 1954 |
"Commands (Other)","SET QUERY_STATISTICS_MAX_ENTRIES"," |
| 1955 |
@h2@ SET QUERY_STATISTICS int |
| 1956 |
"," |
| 1957 |
Set the maximum number of entries in query statistics meta-table. |
| 1958 |
Default value is 100. |
| 1959 |
|
| 1960 |
This setting is not persistent. |
| 1961 |
This command commits an open transaction in this connection. |
| 1962 |
Admin rights are required to execute this command, as it affects all connections. |
| 1963 |
"," |
| 1964 |
SET QUERY_STATISTICS_MAX_ENTRIES 500 |
| 1965 |
" |
| 1966 |
|
| 1967 |
"Commands (Other)","SET QUERY_TIMEOUT"," |
| 1968 |
@h2@ SET QUERY_TIMEOUT int |
| 1969 |
"," |
| 1970 |
Set the query timeout of the current session to the given value. The timeout is |
| 1971 |
in milliseconds. All kinds of statements will throw an exception if they take |
| 1972 |
longer than the given value. The default timeout is 0, meaning no timeout. |
| 1973 |
|
| 1974 |
This command does not commit a transaction, and rollback does not affect it. |
| 1975 |
"," |
| 1976 |
SET QUERY_TIMEOUT 10000 |
| 1977 |
" |
| 1978 |
|
| 1979 |
"Commands (Other)","SET REFERENTIAL_INTEGRITY"," |
| 1980 |
@h2@ SET REFERENTIAL_INTEGRITY { TRUE | FALSE } |
| 1981 |
"," |
| 1982 |
Disabled or enables referential integrity checking for the whole database. |
| 1983 |
Enabling it does not check existing data. Use ALTER TABLE SET to disable it only |
| 1984 |
for one table. |
| 1985 |
|
| 1986 |
This setting is not persistent. |
| 1987 |
This command commits an open transaction in this connection. |
| 1988 |
Admin rights are required to execute this command, as it affects all connections. |
| 1989 |
"," |
| 1990 |
SET REFERENTIAL_INTEGRITY FALSE |
| 1991 |
" |
| 1992 |
|
| 1993 |
"Commands (Other)","SET RETENTION_TIME"," |
| 1994 |
@h2@ SET RETENTION_TIME int |
| 1995 |
"," |
| 1996 |
How long to retain old, persisted data, in milliseconds. |
| 1997 |
The default is 45000 (45 seconds), 0 means overwrite data as early as possible. |
| 1998 |
It is assumed that a file system and hard disk will flush all write buffers within this time. |
| 1999 |
Using a lower value might be dangerous, unless the file system and hard disk flush the buffers earlier. |
| 2000 |
To manually flush the buffers, use CHECKPOINT SYNC, |
| 2001 |
however please note that according to various tests this does not always work as expected |
| 2002 |
depending on the operating system and hardware. |
| 2003 |
|
| 2004 |
Admin rights are required to execute this command, as it affects all connections. |
| 2005 |
This command commits an open transaction in this connection. |
| 2006 |
This setting is persistent. |
| 2007 |
This setting can be appended to the database URL: ""jdbc:h2:./test;RETENTION_TIME=0"" |
| 2008 |
"," |
| 2009 |
SET RETENTION_TIME 0 |
| 2010 |
" |
| 2011 |
|
| 2012 |
"Commands (Other)","SET SALT HASH"," |
| 2013 |
@h2@ SET SALT bytes HASH bytes |
| 2014 |
"," |
| 2015 |
Sets the password salt and hash for the current user. The password must be in |
| 2016 |
single quotes. It is case sensitive and can contain spaces. |
| 2017 |
|
| 2018 |
This command commits an open transaction in this connection. |
| 2019 |
"," |
| 2020 |
SET SALT '00' HASH '1122' |
| 2021 |
" |
| 2022 |
|
| 2023 |
"Commands (Other)","SET SCHEMA"," |
| 2024 |
SET SCHEMA { schemaString | @h2@ { schemaName } } |
| 2025 |
"," |
| 2026 |
Changes the default schema of the current connection. The default schema is used |
| 2027 |
in statements where no schema is set explicitly. The default schema for new |
| 2028 |
connections is PUBLIC. |
| 2029 |
|
| 2030 |
This command does not commit a transaction, and rollback does not affect it. |
| 2031 |
This setting can be appended to the database URL: ""jdbc:h2:./test;SCHEMA=ABC"" |
| 2032 |
"," |
| 2033 |
SET SCHEMA 'PUBLIC' |
| 2034 |
SET SCHEMA INFORMATION_SCHEMA |
| 2035 |
" |
| 2036 |
|
| 2037 |
"Commands (Other)","SET SCHEMA_SEARCH_PATH"," |
| 2038 |
@h2@ SET SCHEMA_SEARCH_PATH schemaName [,...] |
| 2039 |
"," |
| 2040 |
Changes the schema search path of the current connection. The default schema is |
| 2041 |
used in statements where no schema is set explicitly. The default schema for new |
| 2042 |
connections is PUBLIC. |
| 2043 |
|
| 2044 |
This command does not commit a transaction, and rollback does not affect it. |
| 2045 |
This setting can be appended to the database URL: ""jdbc:h2:./test;SCHEMA_SEARCH_PATH=ABC,DEF"" |
| 2046 |
"," |
| 2047 |
SET SCHEMA_SEARCH_PATH INFORMATION_SCHEMA, PUBLIC |
| 2048 |
" |
| 2049 |
|
| 2050 |
"Commands (Other)","SET SESSION CHARACTERISTICS"," |
| 2051 |
SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL |
| 2052 |
{ READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } |
| 2053 |
"," |
| 2054 |
Changes the transaction isolation level of the current session. |
| 2055 |
The actual support of isolation levels depends on the database engine. |
| 2056 |
|
| 2057 |
This command commits an open transaction in this session. |
| 2058 |
"," |
| 2059 |
SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE |
| 2060 |
" |
| 2061 |
|
| 2062 |
"Commands (Other)","SET THROTTLE"," |
| 2063 |
@h2@ SET THROTTLE int |
| 2064 |
"," |
| 2065 |
Sets the throttle for the current connection. The value is the number of |
| 2066 |
milliseconds delay after each 50 ms. The default value is 0 (throttling |
| 2067 |
disabled). |
| 2068 |
|
| 2069 |
This command does not commit a transaction, and rollback does not affect it. |
| 2070 |
This setting can be appended to the database URL: ""jdbc:h2:./test;THROTTLE=50"" |
| 2071 |
"," |
| 2072 |
SET THROTTLE 200 |
| 2073 |
" |
| 2074 |
|
| 2075 |
"Commands (Other)","SET TIME ZONE"," |
| 2076 |
SET TIME ZONE { LOCAL | intervalHourToMinute | @h2@ { intervalHourToSecond | string } } |
| 2077 |
"," |
| 2078 |
Sets the current time zone for the session. |
| 2079 |
|
| 2080 |
This command does not commit a transaction, and rollback does not affect it. |
| 2081 |
This setting can be appended to the database URL: ""jdbc:h2:./test;TIME ZONE='1:00'"" |
| 2082 |
|
| 2083 |
Time zone offset used for [CURRENT_TIME](https://h2database.com/html/functions.html#current_time), |
| 2084 |
[CURRENT_TIMESTAMP](https://h2database.com/html/functions.html#current_timestamp), |
| 2085 |
[CURRENT_DATE](https://h2database.com/html/functions.html#current_date), |
| 2086 |
[LOCALTIME](https://h2database.com/html/functions.html#localtime), |
| 2087 |
and [LOCALTIMESTAMP](https://h2database.com/html/functions.html#localtimestamp) is adjusted, |
| 2088 |
so these functions will return new values based on the same UTC timestamp after execution of this command. |
| 2089 |
"," |
| 2090 |
SET TIME ZONE LOCAL |
| 2091 |
SET TIME ZONE '-5:00' |
| 2092 |
SET TIME ZONE INTERVAL '1:00' HOUR TO MINUTE |
| 2093 |
SET TIME ZONE 'Europe/London' |
| 2094 |
" |
| 2095 |
|
| 2096 |
"Commands (Other)","SET TRACE_LEVEL"," |
| 2097 |
@h2@ SET { TRACE_LEVEL_FILE | TRACE_LEVEL_SYSTEM_OUT } int |
| 2098 |
"," |
| 2099 |
Sets the trace level for file the file or system out stream. Levels are: 0=off, |
| 2100 |
1=error, 2=info, 3=debug. The default level is 1 for file and 0 for system out. |
| 2101 |
To use SLF4J, append "";TRACE_LEVEL_FILE=4"" to the database URL when opening the database. |
| 2102 |
|
| 2103 |
This setting is not persistent. |
| 2104 |
Admin rights are required to execute this command, as it affects all connections. |
| 2105 |
This command does not commit a transaction, and rollback does not affect it. |
| 2106 |
This setting can be appended to the database URL: ""jdbc:h2:./test;TRACE_LEVEL_SYSTEM_OUT=3"" |
| 2107 |
"," |
| 2108 |
SET TRACE_LEVEL_SYSTEM_OUT 3 |
| 2109 |
" |
| 2110 |
|
| 2111 |
"Commands (Other)","SET TRACE_MAX_FILE_SIZE"," |
| 2112 |
@h2@ SET TRACE_MAX_FILE_SIZE int |
| 2113 |
"," |
| 2114 |
Sets the maximum trace file size. If the file exceeds the limit, the file is |
| 2115 |
renamed to .old and a new file is created. If another .old file exists, it is |
| 2116 |
deleted. The default max size is 16 MB. |
| 2117 |
|
| 2118 |
This setting is persistent. |
| 2119 |
Admin rights are required to execute this command, as it affects all connections. |
| 2120 |
This command commits an open transaction in this connection. |
| 2121 |
This setting can be appended to the database URL: ""jdbc:h2:./test;TRACE_MAX_FILE_SIZE=3"" |
| 2122 |
"," |
| 2123 |
SET TRACE_MAX_FILE_SIZE 10 |
| 2124 |
" |
| 2125 |
|
| 2126 |
"Commands (Other)","SET TRUNCATE_LARGE_LENGTH"," |
| 2127 |
@h2@ SET TRUNCATE_LARGE_LENGTH { TRUE | FALSE } |
| 2128 |
"," |
| 2129 |
If ""TRUE"" is specified, the ""CHARACTER"", ""CHARACTER VARYING"", ""VARCHAR_IGNORECASE"", ""BINARY"", |
| 2130 |
"BINARY_VARYING", "JAVA_OBJECT"" and ""JSON"" data types with too large length will be treated as these data types with |
| 2131 |
maximum allowed length instead. |
| 2132 |
By default, or if ""FALSE"" is specified, such definitions throw an exception. |
| 2133 |
This setting can be used for compatibility with definitions from older versions of H2. |
| 2134 |
|
| 2135 |
This setting can be appended to the database URL: ""jdbc:h2:./test;TRUNCATE_LARGE_LENGTH=TRUE"" |
| 2136 |
"," |
| 2137 |
SET TRUNCATE_LARGE_LENGTH TRUE |
| 2138 |
" |
| 2139 |
|
| 2140 |
"Commands (Other)","SET VARIABLE_BINARY"," |
| 2141 |
@h2@ SET VARIABLE_BINARY { TRUE | FALSE } |
| 2142 |
"," |
| 2143 |
If ""TRUE"" is specified, the ""BINARY"" data type will be parsed as ""VARBINARY"" in the current session. |
| 2144 |
It can be used for compatibility with older versions of H2. |
| 2145 |
|
| 2146 |
This setting can be appended to the database URL: ""jdbc:h2:./test;VARIABLE_BINARY=TRUE"" |
| 2147 |
"," |
| 2148 |
SET VARIABLE_BINARY TRUE |
| 2149 |
" |
| 2150 |
|
| 2151 |
"Commands (Other)","SET WRITE_DELAY"," |
| 2152 |
@h2@ SET WRITE_DELAY int |
| 2153 |
"," |
| 2154 |
Set the maximum delay between a commit and flushing the log, in milliseconds. |
| 2155 |
This setting is persistent. The default is 500 ms. |
| 2156 |
|
| 2157 |
Admin rights are required to execute this command, as it affects all connections. |
| 2158 |
This command commits an open transaction in this connection. |
| 2159 |
This setting can be appended to the database URL: ""jdbc:h2:./test;WRITE_DELAY=0"" |
| 2160 |
"," |
| 2161 |
SET WRITE_DELAY 2000 |
| 2162 |
" |
| 2163 |
|
| 2164 |
"Commands (Other)","SHUTDOWN"," |
| 2165 |
@h2@ SHUTDOWN [ IMMEDIATELY | COMPACT | DEFRAG ] |
| 2166 |
"," |
| 2167 |
This statement closes all open connections to the database and closes the |
| 2168 |
database. This command is usually not required, as the database is |
| 2169 |
closed automatically when the last connection to it is closed. |
| 2170 |
|
| 2171 |
If no option is used, then the database is closed normally. |
| 2172 |
All connections are closed, open transactions are rolled back. |
| 2173 |
|
| 2174 |
SHUTDOWN COMPACT fully compacts the database (re-creating the database may further reduce the database size). |
| 2175 |
If the database is closed normally (using SHUTDOWN or by closing all connections), then the database is also compacted, |
| 2176 |
but only for at most the time defined by the database setting ""h2.maxCompactTime"" in milliseconds (see there). |
| 2177 |
|
| 2178 |
SHUTDOWN IMMEDIATELY closes the database files without any cleanup and without compacting. |
| 2179 |
|
| 2180 |
SHUTDOWN DEFRAG is currently equivalent to COMPACT. |
| 2181 |
|
| 2182 |
Admin rights are required to execute this command. |
| 2183 |
"," |
| 2184 |
SHUTDOWN COMPACT |
| 2185 |
" |
| 2186 |
|
| 2187 |
"Literals","Value"," |
| 2188 |
string | @h2@ { dollarQuotedString } | numeric | dateAndTime | boolean | bytes |
| 2189 |
| interval | array | @h2@ { geometry | json | uuid } | null |
| 2190 |
"," |
| 2191 |
A literal value of any data type, or null. |
| 2192 |
"," |
| 2193 |
10 |
| 2194 |
" |
| 2195 |
|
| 2196 |
"Literals","Approximate numeric"," |
| 2197 |
[ + | - ] { { number [ . [ number ] ] } | { . number } } |
| 2198 |
E [ + | - ] expNumber |
| 2199 |
"," |
| 2200 |
An approximate numeric value. |
| 2201 |
Approximate numeric values have [DECFLOAT](https://h2database.com/html/datatypes.html#decfloat_type) data type. |
| 2202 |
To define a [DOUBLE PRECISION](https://h2database.com/html/datatypes.html#double_precision_type) value, use |
| 2203 |
""CAST(X AS DOUBLE PRECISION)"". |
| 2204 |
To define a [REAL](https://h2database.com/html/datatypes.html#real_type) value, use ""CAST(X AS REAL)"". |
| 2205 |
There are some special REAL, DOUBLE PRECISION, and DECFLOAT values: |
| 2206 |
to represent positive infinity, use ""CAST('Infinity' AS dataType)""; |
| 2207 |
for negative infinity, use ""CAST('-Infinity' AS dataType)""; |
| 2208 |
for ""NaN"" (not a number), use ""CAST('NaN' AS dataType)"". |
| 2209 |
"," |
| 2210 |
-1.4e-10 |
| 2211 |
1.111_111E3 |
| 2212 |
CAST(1e2 AS REAL) |
| 2213 |
CAST('NaN' AS DOUBLE PRECISION) |
| 2214 |
" |
| 2215 |
|
| 2216 |
"Literals","Array"," |
| 2217 |
ARRAY '[' [ expression [,...] ] ']' |
| 2218 |
"," |
| 2219 |
An array of values. |
| 2220 |
"," |
| 2221 |
ARRAY[1, 2] |
| 2222 |
ARRAY[1] |
| 2223 |
ARRAY[] |
| 2224 |
" |
| 2225 |
|
| 2226 |
"Literals","Boolean"," |
| 2227 |
TRUE | FALSE | UNKNOWN |
| 2228 |
"," |
| 2229 |
A boolean value. |
| 2230 |
UNKNOWN is a NULL value with the boolean data type. |
| 2231 |
"," |
| 2232 |
TRUE |
| 2233 |
" |
| 2234 |
|
| 2235 |
"Literals","Bytes"," |
| 2236 |
X'hex' [ 'hex' [...] ] |
| 2237 |
"," |
| 2238 |
A binary string value. The hex value is not case sensitive and may contain space characters as separators. |
| 2239 |
If there are more than one group of quoted hex values, groups must be separated with whitespace. |
| 2240 |
"," |
| 2241 |
X'' |
| 2242 |
X'01FF' |
| 2243 |
X'01 bc 2a' |
| 2244 |
X'01' '02' |
| 2245 |
" |
| 2246 |
|
| 2247 |
"Literals","Date"," |
| 2248 |
DATE '[-]yyyy-MM-dd' |
| 2249 |
"," |
| 2250 |
A date literal. |
| 2251 |
"," |
| 2252 |
DATE '2004-12-31' |
| 2253 |
" |
| 2254 |
|
| 2255 |
"Literals","Date and time"," |
| 2256 |
date | time | timeWithTimeZone | timestamp | timestampWithTimeZone |
| 2257 |
"," |
| 2258 |
A literal value of any date-time data type. |
| 2259 |
"," |
| 2260 |
TIMESTAMP '1999-01-31 10:00:00' |
| 2261 |
" |
| 2262 |
|
| 2263 |
"Literals","Dollar Quoted String"," |
| 2264 |
@h2@ $$anythingExceptTwoDollarSigns$$ |
| 2265 |
"," |
| 2266 |
A string starts and ends with two dollar signs. Two dollar signs are not allowed |
| 2267 |
within the text. A whitespace is required before the first set of dollar signs. |
| 2268 |
No escaping is required within the text. |
| 2269 |
"," |
| 2270 |
$$John's car$$ |
| 2271 |
" |
| 2272 |
|
| 2273 |
"Literals","Exact numeric"," |
| 2274 |
[ + | - ] { { number [ . number ] } | { . number } } |
| 2275 |
"," |
| 2276 |
An exact numeric value. |
| 2277 |
Exact numeric values with dot have [NUMERIC](https://h2database.com/html/datatypes.html#numeric_type) data type, values |
| 2278 |
without dot small enough to fit into [INTEGER](https://h2database.com/html/datatypes.html#integer_type) data type have |
| 2279 |
this type, larger values small enough to fit into [BIGINT](https://h2database.com/html/datatypes.html#bigint_type) data |
| 2280 |
type have this type, others also have NUMERIC data type. |
| 2281 |
"," |
| 2282 |
-1600.05 |
| 2283 |
134_518.235_114 |
| 2284 |
" |
| 2285 |
|
| 2286 |
"Literals","Hex Number"," |
| 2287 |
[+|-] {0x|0X} { [_] { digit | a-f | A-F } [...] } [...] |
| 2288 |
"," |
| 2289 |
A number written in hexadecimal notation. |
| 2290 |
"," |
| 2291 |
0xff |
| 2292 |
0x_ABCD_1234 |
| 2293 |
" |
| 2294 |
|
| 2295 |
"Literals","Octal Number"," |
| 2296 |
[+|-] {0o|0O} { [_] { 0-7 } [...] } [...] |
| 2297 |
"," |
| 2298 |
A number written in octal notation. |
| 2299 |
"," |
| 2300 |
0o664 |
| 2301 |
0o_123_777 |
| 2302 |
" |
| 2303 |
|
| 2304 |
"Literals","Binary Number"," |
| 2305 |
[+|-] {0b|0B} { [_] { 0-1 } [...] } [...] |
| 2306 |
"," |
| 2307 |
A number written in binary notation. |
| 2308 |
"," |
| 2309 |
0b101 |
| 2310 |
0b_01010101_10101010 |
| 2311 |
" |
| 2312 |
|
| 2313 |
"Literals","Int"," |
| 2314 |
[ + | - ] number |
| 2315 |
"," |
| 2316 |
The maximum integer number is 2147483647, the minimum is -2147483648. |
| 2317 |
"," |
| 2318 |
10 |
| 2319 |
65_536 |
| 2320 |
" |
| 2321 |
|
| 2322 |
"Literals","GEOMETRY"," |
| 2323 |
@h2@ GEOMETRY { bytes | string } |
| 2324 |
"," |
| 2325 |
A binary string or character string with GEOMETRY object. |
| 2326 |
|
| 2327 |
A binary string should contain Well-known Binary Representation (WKB) from OGC 06-103r4. |
| 2328 |
Dimension system marks may be specified either in both OGC WKB or in PostGIS EWKB formats. |
| 2329 |
Optional SRID from EWKB may be specified. |
| 2330 |
POINT EMPTY stored with NaN values as specified in OGC 12-128r15 is supported. |
| 2331 |
|
| 2332 |
A character string should contain Well-known Text Representation (WKT) from OGC 06-103r4 |
| 2333 |
with optional SRID from PostGIS EWKT extension. |
| 2334 |
|
| 2335 |
"," |
| 2336 |
GEOMETRY 'GEOMETRYCOLLECTION (POINT (1 2))' |
| 2337 |
GEOMETRY X'00000000013ff00000000000003ff0000000000000' |
| 2338 |
" |
| 2339 |
|
| 2340 |
"Literals","JSON"," |
| 2341 |
@h2@ JSON { bytes | string } |
| 2342 |
"," |
| 2343 |
A binary or character string with a RFC 8259-compliant JSON text and data format. |
| 2344 |
JSON text is parsed into internal representation. |
| 2345 |
Order of object members is preserved as is. |
| 2346 |
Duplicate object member names are allowed. |
| 2347 |
"," |
| 2348 |
JSON '{""id"":10,""name"":""What''s this?""}' |
| 2349 |
JSON '[1, ' '2]'; |
| 2350 |
JSON X'7472' '7565' |
| 2351 |
" |
| 2352 |
|
| 2353 |
"Literals","Long"," |
| 2354 |
[ + | - ] number |
| 2355 |
"," |
| 2356 |
Long numbers are between -9223372036854775808 and 9223372036854775807. |
| 2357 |
"," |
| 2358 |
100000 |
| 2359 |
1_000_000_000 |
| 2360 |
" |
| 2361 |
|
| 2362 |
"Literals","Null"," |
| 2363 |
NULL |
| 2364 |
"," |
| 2365 |
NULL is a value without data type and means 'unknown value'. |
| 2366 |
"," |
| 2367 |
NULL |
| 2368 |
" |
| 2369 |
|
| 2370 |
"Literals","Number"," |
| 2371 |
digit [ [_] digit [...] ] [...] |
| 2372 |
"," |
| 2373 |
The maximum length of the number depends on the data type used. |
| 2374 |
"," |
| 2375 |
100 |
| 2376 |
10_000 |
| 2377 |
" |
| 2378 |
|
| 2379 |
"Literals","Numeric"," |
| 2380 |
exactNumeric | approximateNumeric | int | long | hexNumber | octalNumber | binaryNumber |
| 2381 |
"," |
| 2382 |
The data type of a numeric literal is the one of numeric data types, such as NUMERIC, DECFLOAT, BIGINT, or INTEGER |
| 2383 |
depending on format and value. |
| 2384 |
|
| 2385 |
An explicit CAST can be used to change the data type. |
| 2386 |
"," |
| 2387 |
-1600.05 |
| 2388 |
CAST(0 AS DOUBLE PRECISION) |
| 2389 |
-1.4e-10 |
| 2390 |
999_999_999.999_999 |
| 2391 |
" |
| 2392 |
|
| 2393 |
"Literals","String"," |
| 2394 |
[N]'anythingExceptSingleQuote' [...] |
| 2395 |
| U&{'anythingExceptSingleQuote' [...]} [ UESCAPE 'singleCharacter' ] |
| 2396 |
"," |
| 2397 |
A character string literal starts and ends with a single quote. |
| 2398 |
Two single quotes can be used to create a single quote inside a string. |
| 2399 |
Prefix ""N"" means a national character string literal; |
| 2400 |
H2 does not distinguish regular and national character string literals in any way, this prefix has no effect in H2. |
| 2401 |
|
| 2402 |
String literals staring with ""U&"" are Unicode character string literals. |
| 2403 |
All character string literals in H2 may have Unicode characters, |
| 2404 |
but Unicode character string literals may contain Unicode escape sequences ""\0000"" or ""\+000000"", |
| 2405 |
where \ is an escape character, ""0000"" and ""000000"" are Unicode character codes in hexadecimal notation. |
| 2406 |
Optional ""UESCAPE"" clause may be used to specify another escape character, |
| 2407 |
with exception for single quote, double quote, plus sign, and hexadecimal digits (0-9, a-f, and A-F). |
| 2408 |
By default the backslash is used. |
| 2409 |
Two escape characters can be used to include a single character inside a string. |
| 2410 |
Two single quotes can be used to create a single quote inside a string. |
| 2411 |
"," |
| 2412 |
'John''s car' |
| 2413 |
'A' 'B' 'C' |
| 2414 |
U&'W\00f6rter ' '\\ \+01f600 /' |
| 2415 |
U&'|00a1' UESCAPE '|' |
| 2416 |
" |
| 2417 |
|
| 2418 |
"Literals","UUID"," |
| 2419 |
@h2@ UUID '{ digit | a-f | A-F | - } [...]' |
| 2420 |
"," |
| 2421 |
A UUID literal. |
| 2422 |
Must contain 32 hexadecimal digits. Digits may be separated with - signs. |
| 2423 |
"," |
| 2424 |
UUID '12345678-1234-1234-1234-123456789ABC' |
| 2425 |
" |
| 2426 |
|
| 2427 |
"Literals","Time"," |
| 2428 |
TIME [ WITHOUT TIME ZONE ] 'hh:mm:ss[.nnnnnnnnn]' |
| 2429 |
"," |
| 2430 |
A time literal. A value is between 0:00:00 and 23:59:59.999999999 |
| 2431 |
and has nanosecond resolution. |
| 2432 |
"," |
| 2433 |
TIME '23:59:59' |
| 2434 |
" |
| 2435 |
|
| 2436 |
"Literals","Time with time zone"," |
| 2437 |
TIME WITH TIME ZONE 'hh:mm:ss[.nnnnnnnnn]{ @h2@ { Z } | { - | + } timeZoneOffsetString}' |
| 2438 |
"," |
| 2439 |
A time with time zone literal. A value is between 0:00:00 and 23:59:59.999999999 |
| 2440 |
and has nanosecond resolution. |
| 2441 |
"," |
| 2442 |
TIME WITH TIME ZONE '23:59:59+01' |
| 2443 |
TIME WITH TIME ZONE '10:15:30.334-03:30' |
| 2444 |
TIME WITH TIME ZONE '0:00:00Z' |
| 2445 |
" |
| 2446 |
|
| 2447 |
"Literals","Timestamp"," |
| 2448 |
TIMESTAMP [ WITHOUT TIME ZONE ] '[-]yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]' |
| 2449 |
"," |
| 2450 |
A timestamp literal. |
| 2451 |
"," |
| 2452 |
TIMESTAMP '2005-12-31 23:59:59' |
| 2453 |
" |
| 2454 |
|
| 2455 |
"Literals","Timestamp with time zone"," |
| 2456 |
TIMESTAMP WITH TIME ZONE '[-]yyyy-MM-dd hh:mm:ss[.nnnnnnnnn] |
| 2457 |
[ @h2@ { Z } | { - | + } timeZoneOffsetString | @h2@ { timeZoneNameString } ]' |
| 2458 |
"," |
| 2459 |
A timestamp with time zone literal. |
| 2460 |
If name of time zone is specified it will be converted to time zone offset. |
| 2461 |
"," |
| 2462 |
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59Z' |
| 2463 |
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59-10:00' |
| 2464 |
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59.123+05' |
| 2465 |
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59.123456789 Europe/London' |
| 2466 |
" |
| 2467 |
|
| 2468 |
"Literals","Interval"," |
| 2469 |
intervalYear | intervalMonth | intervalDay | intervalHour | intervalMinute |
| 2470 |
| intervalSecond | intervalYearToMonth | intervalDayToHour |
| 2471 |
| intervalDayToMinute | intervalDayToSecond | intervalHourToMinute |
| 2472 |
| intervalHourToSecond | intervalMinuteToSecond |
| 2473 |
"," |
| 2474 |
An interval literal. |
| 2475 |
"," |
| 2476 |
INTERVAL '1-2' YEAR TO MONTH |
| 2477 |
" |
| 2478 |
|
| 2479 |
"Literals","INTERVAL YEAR"," |
| 2480 |
INTERVAL [-|+] '[-|+]yearInt' YEAR [ ( precisionInt ) ] |
| 2481 |
"," |
| 2482 |
An INTERVAL YEAR literal. |
| 2483 |
If precision is specified it should be from 1 to 18. |
| 2484 |
"," |
| 2485 |
INTERVAL '10' YEAR |
| 2486 |
" |
| 2487 |
|
| 2488 |
"Literals","INTERVAL MONTH"," |
| 2489 |
INTERVAL [-|+] '[-|+]monthInt' MONTH [ ( precisionInt ) ] |
| 2490 |
"," |
| 2491 |
An INTERVAL MONTH literal. |
| 2492 |
If precision is specified it should be from 1 to 18. |
| 2493 |
"," |
| 2494 |
INTERVAL '10' MONTH |
| 2495 |
" |
| 2496 |
|
| 2497 |
"Literals","INTERVAL DAY"," |
| 2498 |
INTERVAL [-|+] '[-|+]dayInt' DAY [ ( precisionInt ) ] |
| 2499 |
"," |
| 2500 |
An INTERVAL DAY literal. |
| 2501 |
If precision is specified it should be from 1 to 18. |
| 2502 |
"," |
| 2503 |
INTERVAL '10' DAY |
| 2504 |
" |
| 2505 |
|
| 2506 |
"Literals","INTERVAL HOUR"," |
| 2507 |
INTERVAL [-|+] '[-|+]hourInt' HOUR [ ( precisionInt ) ] |
| 2508 |
"," |
| 2509 |
An INTERVAL HOUR literal. |
| 2510 |
If precision is specified it should be from 1 to 18. |
| 2511 |
"," |
| 2512 |
INTERVAL '10' HOUR |
| 2513 |
" |
| 2514 |
|
| 2515 |
"Literals","INTERVAL MINUTE"," |
| 2516 |
INTERVAL [-|+] '[-|+]minuteInt' MINUTE [ ( precisionInt ) ] |
| 2517 |
"," |
| 2518 |
An INTERVAL MINUTE literal. |
| 2519 |
If precision is specified it should be from 1 to 18. |
| 2520 |
"," |
| 2521 |
INTERVAL '10' MINUTE |
| 2522 |
" |
| 2523 |
|
| 2524 |
"Literals","INTERVAL SECOND"," |
| 2525 |
INTERVAL [-|+] '[-|+]secondInt[.nnnnnnnnn]' |
| 2526 |
SECOND [ ( precisionInt [, fractionalPrecisionInt ] ) ] |
| 2527 |
"," |
| 2528 |
An INTERVAL SECOND literal. |
| 2529 |
If precision is specified it should be from 1 to 18. |
| 2530 |
If fractional seconds precision is specified it should be from 0 to 9. |
| 2531 |
"," |
| 2532 |
INTERVAL '10.123' SECOND |
| 2533 |
" |
| 2534 |
|
| 2535 |
"Literals","INTERVAL YEAR TO MONTH"," |
| 2536 |
INTERVAL [-|+] '[-|+]yearInt-monthInt' YEAR [ ( precisionInt ) ] TO MONTH |
| 2537 |
"," |
| 2538 |
An INTERVAL YEAR TO MONTH literal. |
| 2539 |
If leading field precision is specified it should be from 1 to 18. |
| 2540 |
"," |
| 2541 |
INTERVAL '1-6' YEAR TO MONTH |
| 2542 |
" |
| 2543 |
|
| 2544 |
"Literals","INTERVAL DAY TO HOUR"," |
| 2545 |
INTERVAL [-|+] '[-|+]dayInt hoursInt' DAY [ ( precisionInt ) ] TO HOUR |
| 2546 |
"," |
| 2547 |
An INTERVAL DAY TO HOUR literal. |
| 2548 |
If leading field precision is specified it should be from 1 to 18. |
| 2549 |
"," |
| 2550 |
INTERVAL '10 11' DAY TO HOUR |
| 2551 |
" |
| 2552 |
|
| 2553 |
"Literals","INTERVAL DAY TO MINUTE"," |
| 2554 |
INTERVAL [-|+] '[-|+]dayInt hh:mm' DAY [ ( precisionInt ) ] TO MINUTE |
| 2555 |
"," |
| 2556 |
An INTERVAL DAY TO MINUTE literal. |
| 2557 |
If leading field precision is specified it should be from 1 to 18. |
| 2558 |
"," |
| 2559 |
INTERVAL '10 11:12' DAY TO MINUTE |
| 2560 |
" |
| 2561 |
|
| 2562 |
"Literals","INTERVAL DAY TO SECOND"," |
| 2563 |
INTERVAL [-|+] '[-|+]dayInt hh:mm:ss[.nnnnnnnnn]' DAY [ ( precisionInt ) ] |
| 2564 |
TO SECOND [ ( fractionalPrecisionInt ) ] |
| 2565 |
"," |
| 2566 |
An INTERVAL DAY TO SECOND literal. |
| 2567 |
If leading field precision is specified it should be from 1 to 18. |
| 2568 |
If fractional seconds precision is specified it should be from 0 to 9. |
| 2569 |
"," |
| 2570 |
INTERVAL '10 11:12:13.123' DAY TO SECOND |
| 2571 |
" |
| 2572 |
|
| 2573 |
"Literals","INTERVAL HOUR TO MINUTE"," |
| 2574 |
INTERVAL [-|+] '[-|+]hh:mm' HOUR [ ( precisionInt ) ] TO MINUTE |
| 2575 |
"," |
| 2576 |
An INTERVAL HOUR TO MINUTE literal. |
| 2577 |
If leading field precision is specified it should be from 1 to 18. |
| 2578 |
"," |
| 2579 |
INTERVAL '10:11' HOUR TO MINUTE |
| 2580 |
" |
| 2581 |
|
| 2582 |
"Literals","INTERVAL HOUR TO SECOND"," |
| 2583 |
INTERVAL [-|+] '[-|+]hh:mm:ss[.nnnnnnnnn]' HOUR [ ( precisionInt ) ] |
| 2584 |
TO SECOND [ ( fractionalPrecisionInt ) ] |
| 2585 |
"," |
| 2586 |
An INTERVAL HOUR TO SECOND literal. |
| 2587 |
If leading field precision is specified it should be from 1 to 18. |
| 2588 |
If fractional seconds precision is specified it should be from 0 to 9. |
| 2589 |
"," |
| 2590 |
INTERVAL '10:11:12.123' HOUR TO SECOND |
| 2591 |
" |
| 2592 |
|
| 2593 |
"Literals","INTERVAL MINUTE TO SECOND"," |
| 2594 |
INTERVAL [-|+] '[-|+]mm:ss[.nnnnnnnnn]' MINUTE [ ( precisionInt ) ] |
| 2595 |
TO SECOND [ ( fractionalPrecisionInt ) ] |
| 2596 |
"," |
| 2597 |
An INTERVAL MINUTE TO SECOND literal. |
| 2598 |
If leading field precision is specified it should be from 1 to 18. |
| 2599 |
If fractional seconds precision is specified it should be from 0 to 9. |
| 2600 |
"," |
| 2601 |
INTERVAL '11:12.123' MINUTE TO SECOND |
| 2602 |
" |
| 2603 |
|
| 2604 |
"Datetime fields","Datetime field"," |
| 2605 |
yearField | monthField | dayOfMonthField |
| 2606 |
| hourField | minuteField | secondField |
| 2607 |
| timezoneHourField | timezoneMinuteField |
| 2608 |
| @h2@ { timezoneSecondField |
| 2609 |
| millenniumField | centuryField | decadeField |
| 2610 |
| quarterField |
| 2611 |
| millisecondField | microsecondField | nanosecondField |
| 2612 |
| dayOfYearField |
| 2613 |
| isoDayOfWeekField | isoWeekField | isoWeekYearField |
| 2614 |
| dayOfWeekField | weekField | weekYearField |
| 2615 |
| epochField } |
| 2616 |
"," |
| 2617 |
Fields for EXTRACT, DATEADD, DATEDIFF, and DATE_TRUNC functions. |
| 2618 |
"," |
| 2619 |
YEAR |
| 2620 |
" |
| 2621 |
|
| 2622 |
"Datetime fields","Year field"," |
| 2623 |
YEAR | @c@ { YYYY | YY | SQL_TSI_YEAR } |
| 2624 |
"," |
| 2625 |
Year. |
| 2626 |
"," |
| 2627 |
YEAR |
| 2628 |
" |
| 2629 |
|
| 2630 |
"Datetime fields","Month field"," |
| 2631 |
MONTH | @c@ { MM | M | SQL_TSI_MONTH } |
| 2632 |
"," |
| 2633 |
Month (1-12). |
| 2634 |
"," |
| 2635 |
MONTH |
| 2636 |
" |
| 2637 |
|
| 2638 |
"Datetime fields","Day of month field"," |
| 2639 |
DAY | @c@ { DD | D | SQL_TSI_DAY } |
| 2640 |
"," |
| 2641 |
Day of month (1-31). |
| 2642 |
"," |
| 2643 |
DAY |
| 2644 |
" |
| 2645 |
|
| 2646 |
"Datetime fields","Hour field"," |
| 2647 |
HOUR | @c@ { HH | SQL_TSI_HOUR } |
| 2648 |
"," |
| 2649 |
Hour (0-23). |
| 2650 |
"," |
| 2651 |
HOUR |
| 2652 |
" |
| 2653 |
|
| 2654 |
"Datetime fields","Minute field"," |
| 2655 |
MINUTE | @c@ { MI | N | SQL_TSI_MINUTE } |
| 2656 |
"," |
| 2657 |
Minute (0-59). |
| 2658 |
"," |
| 2659 |
MINUTE |
| 2660 |
" |
| 2661 |
|
| 2662 |
"Datetime fields","Second field"," |
| 2663 |
SECOND | @c@ { SS | S | SQL_TSI_SECOND } |
| 2664 |
"," |
| 2665 |
Second (0-59). |
| 2666 |
"," |
| 2667 |
SECOND |
| 2668 |
" |
| 2669 |
|
| 2670 |
"Datetime fields","Timezone hour field"," |
| 2671 |
TIMEZONE_HOUR |
| 2672 |
"," |
| 2673 |
Timezone hour (from -18 to +18). |
| 2674 |
"," |
| 2675 |
TIMEZONE_HOUR |
| 2676 |
" |
| 2677 |
|
| 2678 |
"Datetime fields","Timezone minute field"," |
| 2679 |
TIMEZONE_MINUTE |
| 2680 |
"," |
| 2681 |
Timezone minute (from -59 to +59). |
| 2682 |
"," |
| 2683 |
TIMEZONE_MINUTE |
| 2684 |
" |
| 2685 |
|
| 2686 |
"Datetime fields","Timezone second field"," |
| 2687 |
@h2@ TIMEZONE_SECOND |
| 2688 |
"," |
| 2689 |
Timezone second (from -59 to +59). |
| 2690 |
Local mean time (LMT) used in the past may have offsets with seconds. |
| 2691 |
Standard time doesn't use such offsets. |
| 2692 |
"," |
| 2693 |
TIMEZONE_SECOND |
| 2694 |
" |
| 2695 |
|
| 2696 |
"Datetime fields","Millennium field"," |
| 2697 |
@h2@ MILLENNIUM |
| 2698 |
"," |
| 2699 |
Century, or one thousand years (2001-01-01 to 3000-12-31). |
| 2700 |
"," |
| 2701 |
MILLENNIUM |
| 2702 |
" |
| 2703 |
|
| 2704 |
"Datetime fields","Century field"," |
| 2705 |
@h2@ CENTURY |
| 2706 |
"," |
| 2707 |
Century, or one hundred years (2001-01-01 to 2100-12-31). |
| 2708 |
"," |
| 2709 |
CENTURY |
| 2710 |
" |
| 2711 |
|
| 2712 |
"Datetime fields","Decade field"," |
| 2713 |
@h2@ DECADE |
| 2714 |
"," |
| 2715 |
Decade, or ten years (2020-01-01 to 2029-12-31). |
| 2716 |
"," |
| 2717 |
DECADE |
| 2718 |
" |
| 2719 |
|
| 2720 |
"Datetime fields","Quarter field"," |
| 2721 |
@h2@ QUARTER |
| 2722 |
"," |
| 2723 |
Quarter (1-4). |
| 2724 |
"," |
| 2725 |
QUARTER |
| 2726 |
" |
| 2727 |
|
| 2728 |
"Datetime fields","Millisecond field"," |
| 2729 |
@h2@ { MILLISECOND } | @c@ { MS } |
| 2730 |
"," |
| 2731 |
Millisecond (0-999). |
| 2732 |
"," |
| 2733 |
MILLISECOND |
| 2734 |
" |
| 2735 |
|
| 2736 |
"Datetime fields","Microsecond field"," |
| 2737 |
@h2@ { MICROSECOND } | @c@ { MCS } |
| 2738 |
"," |
| 2739 |
Microsecond (0-999999). |
| 2740 |
"," |
| 2741 |
MICROSECOND |
| 2742 |
" |
| 2743 |
|
| 2744 |
"Datetime fields","Nanosecond field"," |
| 2745 |
@h2@ { NANOSECOND } | @c@ { NS } |
| 2746 |
"," |
| 2747 |
Nanosecond (0-999999999). |
| 2748 |
"," |
| 2749 |
NANOSECOND |
| 2750 |
" |
| 2751 |
|
| 2752 |
"Datetime fields","Day of year field"," |
| 2753 |
@h2@ { DAYOFYEAR | DAY_OF_YEAR } | @c@ { DOY | DY } |
| 2754 |
"," |
| 2755 |
Day of year (1-366). |
| 2756 |
"," |
| 2757 |
DAYOFYEAR |
| 2758 |
" |
| 2759 |
|
| 2760 |
"Datetime fields","ISO day of week field"," |
| 2761 |
@h2@ { ISO_DAY_OF_WEEK } | @c@ { ISODOW } |
| 2762 |
"," |
| 2763 |
ISO day of week (1-7). Monday is 1. |
| 2764 |
"," |
| 2765 |
ISO_DAY_OF_WEEK |
| 2766 |
" |
| 2767 |
|
| 2768 |
"Datetime fields","ISO week field"," |
| 2769 |
@h2@ ISO_WEEK |
| 2770 |
"," |
| 2771 |
ISO week of year (1-53). |
| 2772 |
ISO definition is used when first week of year should have at least four days |
| 2773 |
and week is started with Monday. |
| 2774 |
"," |
| 2775 |
ISO_WEEK |
| 2776 |
" |
| 2777 |
|
| 2778 |
"Datetime fields","ISO week year field"," |
| 2779 |
@h2@ { ISO_WEEK_YEAR } | @c@ { ISO_YEAR | ISOYEAR } |
| 2780 |
"," |
| 2781 |
Returns the ISO week-based year from a date/time value. |
| 2782 |
"," |
| 2783 |
ISO_WEEK_YEAR |
| 2784 |
" |
| 2785 |
|
| 2786 |
"Datetime fields","Day of week field"," |
| 2787 |
@h2@ { DAY_OF_WEEK | DAYOFWEEK } | @c@ { DOW } |
| 2788 |
"," |
| 2789 |
Day of week (1-7), locale-specific. |
| 2790 |
"," |
| 2791 |
DAY_OF_WEEK |
| 2792 |
" |
| 2793 |
|
| 2794 |
"Datetime fields","Week field"," |
| 2795 |
@h2@ { WEEK } | @c@ { WW | W | SQL_TSI_WEEK } |
| 2796 |
"," |
| 2797 |
Week of year (1-53) using local rules. |
| 2798 |
"," |
| 2799 |
WEEK |
| 2800 |
" |
| 2801 |
|
| 2802 |
"Datetime fields","Week year field"," |
| 2803 |
@h2@ { WEEK_YEAR } |
| 2804 |
"," |
| 2805 |
Returns the week-based year (locale-specific) from a date/time value. |
| 2806 |
"," |
| 2807 |
WEEK_YEAR |
| 2808 |
" |
| 2809 |
|
| 2810 |
"Datetime fields","Epoch field"," |
| 2811 |
@h2@ EPOCH |
| 2812 |
"," |
| 2813 |
For TIMESTAMP values number of seconds since 1970-01-01 00:00:00 in local time zone. |
| 2814 |
For TIMESTAMP WITH TIME ZONE values number of seconds since 1970-01-01 00:00:00 in UTC time zone. |
| 2815 |
For DATE values number of seconds since 1970-01-01. |
| 2816 |
For TIME values number of seconds since midnight. |
| 2817 |
"," |
| 2818 |
EPOCH |
| 2819 |
" |
| 2820 |
|
| 2821 |
"Other Grammar","Alias"," |
| 2822 |
name |
| 2823 |
"," |
| 2824 |
An alias is a name that is only valid in the context of the statement. |
| 2825 |
"," |
| 2826 |
A |
| 2827 |
" |
| 2828 |
|
| 2829 |
"Other Grammar","And Condition"," |
| 2830 |
condition [ { AND condition } [...] ] |
| 2831 |
"," |
| 2832 |
Value or condition. |
| 2833 |
"," |
| 2834 |
ID=1 AND NAME='Hi' |
| 2835 |
" |
| 2836 |
|
| 2837 |
"Other Grammar","Array element reference"," |
| 2838 |
{ array | json } '[' indexInt ']' |
| 2839 |
"," |
| 2840 |
Returns array element at specified 1-based index. |
| 2841 |
Returns NULL if array or json is null, index is null, or element with specified index isn't found in JSON. |
| 2842 |
"," |
| 2843 |
A[2] |
| 2844 |
M[5][8] |
| 2845 |
" |
| 2846 |
|
| 2847 |
"Other Grammar","Field reference"," |
| 2848 |
(expression).fieldName |
| 2849 |
"," |
| 2850 |
Returns field value from the row value or JSON value. |
| 2851 |
Returns NULL if value is null or field with specified name isn't found in JSON. |
| 2852 |
Expression on the left must be enclosed in parentheses if it is an identifier (column name), |
| 2853 |
in other cases they aren't required. |
| 2854 |
"," |
| 2855 |
(R).FIELD1 |
| 2856 |
(TABLE1.COLUMN2).FIELD.SUBFIELD |
| 2857 |
JSON '{""a"": 1, ""b"": 2}'.""b"" |
| 2858 |
" |
| 2859 |
|
| 2860 |
"Other Grammar","Array value constructor by query"," |
| 2861 |
ARRAY (query) |
| 2862 |
"," |
| 2863 |
Collects values from the subquery into array. |
| 2864 |
|
| 2865 |
The subquery should have exactly one column. |
| 2866 |
Number of elements in the returned array is the number of rows in the subquery. |
| 2867 |
NULL values are included into array. |
| 2868 |
"," |
| 2869 |
ARRAY(SELECT * FROM SYSTEM_RANGE(1, 10)); |
| 2870 |
" |
| 2871 |
|
| 2872 |
"Other Grammar","Case expression"," |
| 2873 |
simpleCase | searchedCase |
| 2874 |
"," |
| 2875 |
Performs conditional evaluation of expressions. |
| 2876 |
"," |
| 2877 |
CASE A WHEN 'a' THEN 1 ELSE 2 END |
| 2878 |
CASE WHEN V > 10 THEN 1 WHEN V < 0 THEN 2 END |
| 2879 |
CASE WHEN A IS NULL THEN 'Null' ELSE 'Not null' END |
| 2880 |
" |
| 2881 |
|
| 2882 |
"Other Grammar","Simple case"," |
| 2883 |
CASE expression |
| 2884 |
{ WHEN { expression | conditionRightHandSide } [,...] THEN expression } [...] |
| 2885 |
[ ELSE expression ] END |
| 2886 |
"," |
| 2887 |
Returns then expression from the first when clause where one of its operands was was evaluated to ""TRUE"" |
| 2888 |
for the case expression. |
| 2889 |
If there are no such clauses, returns else expression or NULL if it is absent. |
| 2890 |
|
| 2891 |
Plain expressions are tested for equality with the case expression, ""NULL"" is not equal to ""NULL"". |
| 2892 |
Right sides of conditions are evaluated with the case expression on the left side. |
| 2893 |
"," |
| 2894 |
CASE CNT WHEN IS NULL THEN 'Null' WHEN 0 THEN 'No' WHEN 1 THEN 'One' WHEN 2, 3 THEN 'Few' ELSE 'Some' END |
| 2895 |
" |
| 2896 |
|
| 2897 |
"Other Grammar","Searched case"," |
| 2898 |
CASE { WHEN expression THEN expression } [...] |
| 2899 |
[ ELSE expression ] END |
| 2900 |
"," |
| 2901 |
Returns the first expression where the condition is true. If no else part is |
| 2902 |
specified, return NULL. |
| 2903 |
"," |
| 2904 |
CASE WHEN CNT<10 THEN 'Low' ELSE 'High' END |
| 2905 |
CASE WHEN A IS NULL THEN 'Null' ELSE 'Not null' END |
| 2906 |
" |
| 2907 |
|
| 2908 |
"Other Grammar","Cast specification"," |
| 2909 |
CAST(value AS dataTypeOrDomain [ FORMAT templateString ]) |
| 2910 |
"," |
| 2911 |
Converts a value to another data type. The following conversion rules are used: |
| 2912 |
When converting a number to a boolean, 0 is false and every other value is true. |
| 2913 |
When converting a boolean to a number, false is 0 and true is 1. |
| 2914 |
When converting a number to a number of another type, the value is checked for overflow. |
| 2915 |
When converting a string to binary, UTF-8 encoding is used. |
| 2916 |
Note that some data types may need explicitly specified precision to avoid overflow or rounding. |
| 2917 |
|
| 2918 |
Template may only be specified for casts from datetime data types to character string data types |
| 2919 |
and for casts from character string data types to datetime data types. |
| 2920 |
|
| 2921 |
'-', '.', '/', ',', '''', ';', ':' and ' ' (space) characters can be used as delimiters. |
| 2922 |
|
| 2923 |
Y, YY, YYY, YYYY represent last 1, 2, 3, or 4 digits of year. |
| 2924 |
YYYY, if delimited, can also be used to parse any year, including negative years. |
| 2925 |
When a year is parsed with Y, YY, or YYY pattern missing leading digits are filled using digits from the current year. |
| 2926 |
|
| 2927 |
RR and RRRR have the same meaning as YY and YYYY for formatting. |
| 2928 |
When a year is parsed with RR, the resulting year is within current year - 49 years and current year + 50 years in H2, |
| 2929 |
other database systems may use different range of years. |
| 2930 |
|
| 2931 |
MM represent a month. |
| 2932 |
|
| 2933 |
DD represent a day of month. |
| 2934 |
|
| 2935 |
DDD represent a day of year, if this pattern in specified, MM and DD may not be specified. |
| 2936 |
|
| 2937 |
HH24 represent an hour (from 0 to 23). |
| 2938 |
|
| 2939 |
HH and HH12 represent an hour (from 1 to 12), this pattern may only be used together with A.M. or P.M. pattern. |
| 2940 |
These patterns may not be used together with HH24. |
| 2941 |
|
| 2942 |
MI represent minutes. |
| 2943 |
|
| 2944 |
SS represent seconds of minute. |
| 2945 |
|
| 2946 |
SSSSS represent seconds of day, this pattern may not be used together with HH24, HH (HH12), A.M. (P.M.), MI or SS pattern. |
| 2947 |
|
| 2948 |
FF1, FF2, ..., FF9 represent fractional seconds. |
| 2949 |
|
| 2950 |
TZH, TZM and TZH represent hours, minutes and seconds of time zone offset. |
| 2951 |
|
| 2952 |
Multiple patterns for the same datetime field may not be specified. |
| 2953 |
|
| 2954 |
If year is not specified, current year is used. If month is not specified, current month is used. If day is not specified, 1 is used. |
| 2955 |
|
| 2956 |
If some fields of time or time zone are not specified, 0 is used. |
| 2957 |
|
| 2958 |
"," |
| 2959 |
CAST(NAME AS INT); |
| 2960 |
CAST(TIMESTAMP '2010-01-01 10:40:00.123456' AS TIME(6)); |
| 2961 |
CAST('12:00:00 P.M.' AS TIME FORMAT 'HH:MI:SS A.M.'); |
| 2962 |
" |
| 2963 |
|
| 2964 |
"Other Grammar","Cipher"," |
| 2965 |
@h2@ AES |
| 2966 |
"," |
| 2967 |
Only the algorithm AES (""AES-128"") is supported currently. |
| 2968 |
"," |
| 2969 |
AES |
| 2970 |
" |
| 2971 |
|
| 2972 |
"Other Grammar","Column Definition"," |
| 2973 |
dataTypeOrDomain @h2@ [ VISIBLE | INVISIBLE ] |
| 2974 |
[ { DEFAULT expression |
| 2975 |
| GENERATED ALWAYS AS (generatedColumnExpression) |
| 2976 |
| GENERATED {ALWAYS | BY DEFAULT} AS IDENTITY [(sequenceOption [...])]} ] |
| 2977 |
@h2@ [ ON UPDATE expression ] |
| 2978 |
@h2@ [ DEFAULT ON NULL ] |
| 2979 |
@h2@ [ SELECTIVITY selectivityInt ] @h2@ [ COMMENT expression ] |
| 2980 |
[ columnConstraintDefinition ] [...] |
| 2981 |
"," |
| 2982 |
The default expression is used if no explicit value was used when adding a row |
| 2983 |
and when DEFAULT value was specified in an update command. |
| 2984 |
|
| 2985 |
A column is either a generated column or a base column. |
| 2986 |
The generated column has a generated column expression. |
| 2987 |
The generated column expression is evaluated and assigned whenever the row changes. |
| 2988 |
This expression may reference base columns of the table, but may not reference other data. |
| 2989 |
The value of the generated column cannot be set explicitly. |
| 2990 |
Generated columns may not have DEFAULT or ON UPDATE expressions. |
| 2991 |
|
| 2992 |
On update column expression is used if row is updated, |
| 2993 |
at least one column has a new value that is different from its previous value |
| 2994 |
and value for this column is not set explicitly in update statement. |
| 2995 |
|
| 2996 |
Identity column is a column generated with a sequence. |
| 2997 |
The column declared as the identity column with IDENTITY data type or with IDENTITY () clause |
| 2998 |
is implicitly the primary key column of this table. |
| 2999 |
GENERATED ALWAYS AS IDENTITY, GENERATED BY DEFAULT AS IDENTITY, and AUTO_INCREMENT clauses |
| 3000 |
do not create the primary key constraint automatically. |
| 3001 |
GENERATED ALWAYS AS IDENTITY clause indicates that column can only be generated by the sequence, |
| 3002 |
its value cannot be set explicitly. |
| 3003 |
Identity column has implicit NOT NULL constraint. |
| 3004 |
Identity column may not have DEFAULT or ON UPDATE expressions. |
| 3005 |
|
| 3006 |
DEFAULT ON NULL makes NULL value work as DEFAULT value is assignments to this column. |
| 3007 |
|
| 3008 |
The invisible column will not be displayed as a result of SELECT * query. |
| 3009 |
Otherwise, it works as normal column. |
| 3010 |
|
| 3011 |
Column constraint definitions are not supported for ALTER statements. |
| 3012 |
"," |
| 3013 |
CREATE TABLE TEST(ID INT PRIMARY KEY, |
| 3014 |
NAME VARCHAR(255) DEFAULT '' NOT NULL); |
| 3015 |
CREATE TABLE TEST(ID BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, |
| 3016 |
QUANTITY INT, PRICE NUMERIC(10, 2), |
| 3017 |
AMOUNT NUMERIC(20, 2) GENERATED ALWAYS AS (QUANTITY * PRICE)); |
| 3018 |
" |
| 3019 |
|
| 3020 |
"Other Grammar","Column Constraint Definition"," |
| 3021 |
[ constraintNameDefinition ] |
| 3022 |
NOT NULL | PRIMARY KEY | UNIQUE [ nullsDistinct ] | referencesSpecification | CHECK (condition) |
| 3023 |
"," |
| 3024 |
NOT NULL disallows NULL value for a column. |
| 3025 |
|
| 3026 |
PRIMARY KEY and UNIQUE require unique values. |
| 3027 |
PRIMARY KEY also disallows NULL values and marks the column as a primary key. |
| 3028 |
UNIQUE constraint allows NULL values, if nulls distinct clause is not specified, the default is NULLS DISTINCT, |
| 3029 |
excluding some compatibility modes. |
| 3030 |
|
| 3031 |
Referential constraint requires values that exist in other column (usually in another table). |
| 3032 |
|
| 3033 |
Check constraint require a specified condition to return TRUE or UNKNOWN (NULL). |
| 3034 |
It can reference columns of the table, and can reference objects that exist while the statement is executed. |
| 3035 |
Conditions are only checked when a row is added or modified in the table where the constraint exists. |
| 3036 |
"," |
| 3037 |
NOT NULL |
| 3038 |
PRIMARY KEY |
| 3039 |
UNIQUE |
| 3040 |
REFERENCES T2(ID) |
| 3041 |
CHECK (VALUE > 0) |
| 3042 |
" |
| 3043 |
|
| 3044 |
"Other Grammar","Comment"," |
| 3045 |
bracketedComment | -- anythingUntilEndOfLine | @c@ // anythingUntilEndOfLine |
| 3046 |
"," |
| 3047 |
Comments can be used anywhere in a command and are ignored by the database. |
| 3048 |
Line comments ""--"" and ""//"" end with a newline. |
| 3049 |
"," |
| 3050 |
-- comment |
| 3051 |
/* comment */ |
| 3052 |
" |
| 3053 |
|
| 3054 |
"Other Grammar","Bracketed comment"," |
| 3055 |
/* [ [ bracketedComment ] [ anythingUntilCommentStartOrEnd ] [...] ] */ |
| 3056 |
"," |
| 3057 |
Comments can be used anywhere in a command and are ignored by the database. |
| 3058 |
Bracketed comments ""/* */"" can be nested and can be multiple lines long. |
| 3059 |
"," |
| 3060 |
/* comment */ |
| 3061 |
/* comment /* nested comment */ comment */ |
| 3062 |
" |
| 3063 |
|
| 3064 |
"Other Grammar","Compare"," |
| 3065 |
<> | <= | >= | = | < | > | @c@ { != } | @h2@ && |
| 3066 |
"," |
| 3067 |
Comparison operator. The operator != is the same as <>. |
| 3068 |
The operator ""&&"" means overlapping; it can only be used with geometry types. |
| 3069 |
"," |
| 3070 |
<> |
| 3071 |
" |
| 3072 |
|
| 3073 |
"Other Grammar","Condition"," |
| 3074 |
operand [ conditionRightHandSide ] |
| 3075 |
| NOT condition |
| 3076 |
| EXISTS ( query ) |
| 3077 |
| UNIQUE [ nullsDistinct ] ( query ) |
| 3078 |
| @h2@ INTERSECTS (operand, operand) |
| 3079 |
"," |
| 3080 |
Boolean value or condition. |
| 3081 |
|
| 3082 |
""NOT"" condition negates the result of subcondition and returns ""TRUE"", ""FALSE"", or ""UNKNOWN"" (""NULL""). |
| 3083 |
|
| 3084 |
""EXISTS"" predicate tests whether the result of the specified subquery is not empty and returns ""TRUE"" or ""FALSE"". |
| 3085 |
|
| 3086 |
""UNIQUE"" predicate tests absence of duplicate rows in the specified subquery and returns ""TRUE"" or ""FALSE"". |
| 3087 |
If nulls distinct clause is not specified, NULLS DISTINCT is implicit. |
| 3088 |
|
| 3089 |
""INTERSECTS"" checks whether 2D bounding boxes of specified geometries intersect with each other |
| 3090 |
and returns ""TRUE"" or ""FALSE"". |
| 3091 |
"," |
| 3092 |
ID <> 2 |
| 3093 |
NOT(A OR B) |
| 3094 |
EXISTS (SELECT NULL FROM TEST T WHERE T.GROUP_ID = P.ID) |
| 3095 |
UNIQUE (SELECT A, B FROM TEST T WHERE T.CATEGORY = CAT) |
| 3096 |
INTERSECTS(GEOM1, GEOM2) |
| 3097 |
" |
| 3098 |
|
| 3099 |
"Other Grammar","Condition Right Hand Side"," |
| 3100 |
comparisonRightHandSide |
| 3101 |
| quantifiedComparisonRightHandSide |
| 3102 |
| nullPredicateRightHandSide |
| 3103 |
| distinctPredicateRightHandSide |
| 3104 |
| quantifiedDistinctPredicateRightHandSide |
| 3105 |
| booleanTestRightHandSide |
| 3106 |
| typePredicateRightHandSide |
| 3107 |
| jsonPredicateRightHandSide |
| 3108 |
| betweenPredicateRightHandSide |
| 3109 |
| inPredicateRightHandSide |
| 3110 |
| likePredicateRightHandSide |
| 3111 |
| regexpPredicateRightHandSide |
| 3112 |
"," |
| 3113 |
The right hand side of a condition. |
| 3114 |
"," |
| 3115 |
> 10 |
| 3116 |
IS NULL |
| 3117 |
IS NOT NULL |
| 3118 |
IS NOT DISTINCT FROM B |
| 3119 |
IS OF (DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE) |
| 3120 |
IS JSON OBJECT WITH UNIQUE KEYS |
| 3121 |
LIKE 'Jo%' |
| 3122 |
" |
| 3123 |
|
| 3124 |
"Other Grammar","Comparison Right Hand Side"," |
| 3125 |
compare operand |
| 3126 |
"," |
| 3127 |
Right side of comparison predicates. |
| 3128 |
"," |
| 3129 |
> 10 |
| 3130 |
" |
| 3131 |
|
| 3132 |
"Other Grammar","Quantified Comparison Right Hand Side"," |
| 3133 |
compare { ALL | ANY | SOME } ( { query | @h2@ { array } } ) |
| 3134 |
"," |
| 3135 |
Right side of quantified comparison predicates. |
| 3136 |
|
| 3137 |
Quantified comparison predicate ALL returns TRUE if specified comparison operation between |
| 3138 |
left size of condition and each row from a subquery or each element of array returns TRUE, |
| 3139 |
including case when there are no rows (elements). |
| 3140 |
ALL predicate returns FALSE if at least one such comparison returns FALSE. |
| 3141 |
Otherwise it returns UNKNOWN. |
| 3142 |
|
| 3143 |
Quantified comparison predicates ANY and SOME return TRUE if specified comparison operation between |
| 3144 |
left size of condition and at least one row from a subquery or at least one element of array returns TRUE. |
| 3145 |
ANY and SOME predicates return FALSE if all such comparisons return FALSE. |
| 3146 |
Otherwise they return UNKNOWN. |
| 3147 |
|
| 3148 |
Note that these predicates have priority over ANY and SOME aggregate functions with subquery on the right side. |
| 3149 |
Use parentheses around aggregate function. |
| 3150 |
|
| 3151 |
If version with array is required and this array is returned from a subquery, wrap this subquery with a cast |
| 3152 |
to distinguish this operation from standard quantified comparison predicate with a query. |
| 3153 |
"," |
| 3154 |
< ALL(SELECT V FROM TEST) |
| 3155 |
= ANY(ARRAY_COLUMN) |
| 3156 |
= ANY(CAST((SELECT ARRAY_COLUMN FROM OTHER_TABLE WHERE ID = 5) AS INTEGER ARRAY) |
| 3157 |
" |
| 3158 |
|
| 3159 |
"Other Grammar","Null Predicate Right Hand Side"," |
| 3160 |
IS [ NOT ] NULL |
| 3161 |
"," |
| 3162 |
Right side of null predicate. |
| 3163 |
|
| 3164 |
Check whether the specified value(s) are NULL values. |
| 3165 |
To test multiple values a row value must be specified. |
| 3166 |
""IS NULL"" returns ""TRUE"" if and only if all values are ""NULL"" values; otherwise it returns ""FALSE"". |
| 3167 |
""IS NOT NULL"" returns ""TRUE"" if and only if all values are not ""NULL"" values; otherwise it returns ""FALSE"". |
| 3168 |
"," |
| 3169 |
IS NULL |
| 3170 |
" |
| 3171 |
|
| 3172 |
"Other Grammar","Distinct Predicate Right Hand Side"," |
| 3173 |
IS [ NOT ] [ DISTINCT FROM ] operand |
| 3174 |
"," |
| 3175 |
Right side of distinct predicate. |
| 3176 |
|
| 3177 |
Distinct predicate is null-safe, meaning NULL is considered the same as NULL, |
| 3178 |
and the condition never evaluates to UNKNOWN. |
| 3179 |
"," |
| 3180 |
IS NOT DISTINCT FROM OTHER |
| 3181 |
" |
| 3182 |
|
| 3183 |
"Other Grammar","Quantified Distinct Predicate Right Hand Side"," |
| 3184 |
@h2@ IS [ NOT ] [ DISTINCT FROM ] { ALL | ANY | SOME } ( { query | array } ) |
| 3185 |
"," |
| 3186 |
Right side of quantified distinct predicate. |
| 3187 |
|
| 3188 |
Quantified distinct predicate is null-safe, meaning NULL is considered the same as NULL, |
| 3189 |
and the condition never evaluates to UNKNOWN. |
| 3190 |
|
| 3191 |
Quantified distinct predicate ALL returns TRUE if specified distinct predicate between |
| 3192 |
left size of condition and each row from a subquery or each element of array returns TRUE, |
| 3193 |
including case when there are no rows. |
| 3194 |
Otherwise it returns FALSE. |
| 3195 |
|
| 3196 |
Quantified distinct predicates ANY and SOME return TRUE if specified distinct predicate between |
| 3197 |
left size of condition and at least one row from a subquery or at least one element of array returns TRUE. |
| 3198 |
Otherwise they return FALSE. |
| 3199 |
|
| 3200 |
Note that these predicates have priority over ANY and SOME aggregate functions with subquery on the right side. |
| 3201 |
Use parentheses around aggregate function. |
| 3202 |
|
| 3203 |
If version with array is required and this array is returned from a subquery, wrap this subquery with a cast |
| 3204 |
to distinguish this operation from quantified comparison predicate with a query. |
| 3205 |
"," |
| 3206 |
IS DISTINCT FROM ALL(SELECT V FROM TEST) |
| 3207 |
IS NOT DISTINCT FROM ANY(ARRAY_COLUMN) |
| 3208 |
IS NOT DISTINCT FROM ANY(CAST((SELECT ARRAY_COLUMN FROM OTHER_TABLE WHERE ID = 5) AS INTEGER ARRAY) |
| 3209 |
" |
| 3210 |
|
| 3211 |
"Other Grammar","Boolean Test Right Hand Side"," |
| 3212 |
IS [ NOT ] { TRUE | FALSE | UNKNOWN } |
| 3213 |
"," |
| 3214 |
Right side of boolean test. |
| 3215 |
|
| 3216 |
Checks whether the specified value is (not) ""TRUE"", ""FALSE"", or ""UNKNOWN"" (""NULL"") |
| 3217 |
and return ""TRUE"" or ""FALSE"". |
| 3218 |
This test is null-safe. |
| 3219 |
"," |
| 3220 |
IS TRUE |
| 3221 |
" |
| 3222 |
|
| 3223 |
"Other Grammar","Type Predicate Right Hand Side"," |
| 3224 |
IS [ NOT ] OF (dataType [,...]) |
| 3225 |
"," |
| 3226 |
Right side of type predicate. |
| 3227 |
|
| 3228 |
Checks whether the data type of the specified operand is one of the specified data types. |
| 3229 |
Some data types have multiple names, these names are considered as equal here. |
| 3230 |
Domains and their base data types are currently not distinguished from each other. |
| 3231 |
Precision and scale are also ignored. |
| 3232 |
If operand is NULL, the result is UNKNOWN. |
| 3233 |
"," |
| 3234 |
IS OF (INTEGER, BIGINT) |
| 3235 |
" |
| 3236 |
|
| 3237 |
"Other Grammar","JSON Predicate Right Hand Side"," |
| 3238 |
IS [ NOT ] JSON [ VALUE | ARRAY | OBJECT | SCALAR ] |
| 3239 |
[ [ WITH | WITHOUT ] UNIQUE [ KEYS ] ] |
| 3240 |
"," |
| 3241 |
Right side of JSON predicate. |
| 3242 |
|
| 3243 |
Checks whether value of the specified string, binary data, or a JSON is a valid JSON. |
| 3244 |
If ""ARRAY"", ""OBJECT"", or ""SCALAR"" is specified, only JSON items of the specified type are considered as valid. |
| 3245 |
If ""WITH UNIQUE [ KEYS ]"" is specified only JSON with unique keys is considered as valid. |
| 3246 |
This predicate isn't null-safe, it returns UNKNOWN if operand is NULL. |
| 3247 |
"," |
| 3248 |
IS JSON OBJECT WITH UNIQUE KEYS |
| 3249 |
" |
| 3250 |
|
| 3251 |
"Other Grammar","Between Predicate Right Hand Side"," |
| 3252 |
[ NOT ] BETWEEN [ ASYMMETRIC | SYMMETRIC ] operand AND operand |
| 3253 |
"," |
| 3254 |
Right side of between predicate. |
| 3255 |
|
| 3256 |
Checks whether the value is within the range inclusive. |
| 3257 |
""V BETWEEN [ ASYMMETRIC ] A AND B"" is equivalent to ""A <= V AND V <= B"". |
| 3258 |
""V BETWEEN SYMMETRIC A AND B"" is equivalent to ""A <= V AND V <= B OR A >= V AND V >= B"". |
| 3259 |
"," |
| 3260 |
BETWEEN LOW AND HIGH |
| 3261 |
" |
| 3262 |
|
| 3263 |
"Other Grammar","In Predicate Right Hand Side"," |
| 3264 |
[ NOT ] IN ( { query | expression [,...] } ) |
| 3265 |
"," |
| 3266 |
Right side of in predicate. |
| 3267 |
|
| 3268 |
Checks presence of value in the specified list of values or in result of the specified query. |
| 3269 |
|
| 3270 |
Returns ""TRUE"" if row value on the left side is equal to one of values on the right side, |
| 3271 |
""FALSE"" if all comparison operations were evaluated to ""FALSE"" or right side has no values, |
| 3272 |
and ""UNKNOWN"" otherwise. |
| 3273 |
|
| 3274 |
This operation is logically equivalent to ""OR"" between comparison operations |
| 3275 |
comparing left side and each value from the right side. |
| 3276 |
"," |
| 3277 |
IN (A, B, C) |
| 3278 |
IN (SELECT V FROM TEST) |
| 3279 |
" |
| 3280 |
|
| 3281 |
"Other Grammar","Like Predicate Right Hand Side"," |
| 3282 |
[ NOT ] { LIKE | @h2@ { ILIKE } } operand [ ESCAPE string ] |
| 3283 |
"," |
| 3284 |
Right side of like predicate. |
| 3285 |
|
| 3286 |
The wildcards characters are ""_"" (any one character) and ""%"" (any characters). |
| 3287 |
The database uses an index when comparing with LIKE except if the operand starts with a wildcard. |
| 3288 |
To search for the characters ""%"" and ""_"", the characters need to be escaped. |
| 3289 |
The default escape character is "" \ "" (backslash). |
| 3290 |
To select no escape character, use ""ESCAPE ''"" (empty string). |
| 3291 |
At most one escape character is allowed. |
| 3292 |
Each character that follows the escape character in the pattern needs to match exactly. |
| 3293 |
Patterns that end with an escape character are invalid and the expression returns NULL. |
| 3294 |
|
| 3295 |
ILIKE does a case-insensitive compare. |
| 3296 |
"," |
| 3297 |
LIKE 'a%' |
| 3298 |
" |
| 3299 |
|
| 3300 |
"Other Grammar","Regexp Predicate Right Hand Side"," |
| 3301 |
@h2@ { [ NOT ] REGEXP operand } |
| 3302 |
"," |
| 3303 |
Right side of Regexp predicate. |
| 3304 |
|
| 3305 |
Regular expression matching is used. |
| 3306 |
See Java ""Matcher.find"" for details. |
| 3307 |
"," |
| 3308 |
REGEXP '[a-z]' |
| 3309 |
" |
| 3310 |
|
| 3311 |
"Other Grammar","Nulls Distinct"," |
| 3312 |
NULLS { DISTINCT | NOT DISTINCT | @h2@ { ALL DISTINCT } } |
| 3313 |
"," |
| 3314 |
Are nulls distinct for unique constraint, index, or predicate. |
| 3315 |
|
| 3316 |
If NULLS DISTINCT is specified, rows with null value in any column are distinct. |
| 3317 |
If NULLS ALL DISTINCT is specified, rows with null value in all columns are distinct. |
| 3318 |
If NULLS NOT DISTINCT is specified, null values are identical. |
| 3319 |
|
| 3320 |
Treatment of null values inside composite data types is not affected. |
| 3321 |
"," |
| 3322 |
NULLS DISTINCT |
| 3323 |
NULLS NOT DISTINCT |
| 3324 |
" |
| 3325 |
|
| 3326 |
"Other Grammar","Table Constraint Definition"," |
| 3327 |
[ constraintNameDefinition ] |
| 3328 |
{ PRIMARY KEY @h2@ [ HASH ] ( columnName [,...] ) } |
| 3329 |
| UNIQUE [ nullsDistinct ] ( { columnName [,...] | VALUE } ) |
| 3330 |
| referentialConstraint |
| 3331 |
| CHECK (condition) |
| 3332 |
"," |
| 3333 |
Defines a constraint. |
| 3334 |
|
| 3335 |
PRIMARY KEY and UNIQUE require unique values. |
| 3336 |
PRIMARY KEY also disallows NULL values and marks the column as a primary key, a table can have only one primary key. |
| 3337 |
UNIQUE constraint supports NULL values and rows with NULL value in any column are considered as unique. |
| 3338 |
UNIQUE constraint allows NULL values, if nulls distinct clause is not specified, the default is NULLS DISTINCT, |
| 3339 |
excluding some compatibility modes. |
| 3340 |
UNIQUE (VALUE) creates a unique constraint on entire row, excluding invisible columns; |
| 3341 |
but if new columns will be added to the table, they will not be included into this constraint. |
| 3342 |
|
| 3343 |
Referential constraint requires values that exist in other column(s) (usually in another table). |
| 3344 |
|
| 3345 |
Check constraint requires a specified condition to return TRUE or UNKNOWN (NULL). |
| 3346 |
It can reference columns of the table, and can reference objects that exist while the statement is executed. |
| 3347 |
Conditions are only checked when a row is added or modified in the table where the constraint exists. |
| 3348 |
"," |
| 3349 |
PRIMARY KEY(ID, NAME) |
| 3350 |
" |
| 3351 |
|
| 3352 |
"Other Grammar","Constraint Name Definition"," |
| 3353 |
CONSTRAINT @h2@ [ IF NOT EXISTS ] newConstraintName |
| 3354 |
"," |
| 3355 |
Defines a constraint name. |
| 3356 |
"," |
| 3357 |
CONSTRAINT CONST_ID |
| 3358 |
" |
| 3359 |
|
| 3360 |
"Other Grammar","Csv Options"," |
| 3361 |
@h2@ charsetString [, fieldSepString [, fieldDelimString [, escString [, nullString]]]] |
| 3362 |
| optionString |
| 3363 |
"," |
| 3364 |
Optional parameters for CSVREAD and CSVWRITE. |
| 3365 |
Instead of setting the options one by one, all options can be |
| 3366 |
combined into a space separated key-value pairs, as follows: |
| 3367 |
""STRINGDECODE('charset=UTF-8 escape=\"" fieldDelimiter=\"" fieldSeparator=, ' ||"" |
| 3368 |
""'lineComment=# lineSeparator=\n null= rowSeparator=')"". |
| 3369 |
The following options are supported: |
| 3370 |
|
| 3371 |
""caseSensitiveColumnNames"" (true or false; disabled by default), |
| 3372 |
|
| 3373 |
""charset"" (for example 'UTF-8'), |
| 3374 |
|
| 3375 |
""escape"" (the character that escapes the field delimiter), |
| 3376 |
|
| 3377 |
""fieldDelimiter"" (a double quote by default), |
| 3378 |
|
| 3379 |
""fieldSeparator"" (a comma by default), |
| 3380 |
|
| 3381 |
""lineComment"" (disabled by default), |
| 3382 |
|
| 3383 |
""lineSeparator"" (the line separator used for writing; ignored for reading), |
| 3384 |
|
| 3385 |
""null"", Support reading existing CSV files that contain explicit ""null"" delimiters. |
| 3386 |
Note that an empty, unquoted values are also treated as null. |
| 3387 |
|
| 3388 |
""preserveWhitespace"" (true or false; disabled by default), |
| 3389 |
|
| 3390 |
""writeColumnHeader"" (true or false; enabled by default). |
| 3391 |
|
| 3392 |
For a newline or other special character, use STRINGDECODE as in the example above. |
| 3393 |
A space needs to be escaped with a backslash (""'\ '""), and |
| 3394 |
a backslash needs to be escaped with another backslash (""'\\'""). |
| 3395 |
All other characters are not to be escaped, that means |
| 3396 |
newline and tab characters are written as such. |
| 3397 |
"," |
| 3398 |
CALL CSVWRITE('test2.csv', 'SELECT * FROM TEST', 'charset=UTF-8 fieldSeparator=|'); |
| 3399 |
" |
| 3400 |
|
| 3401 |
"Other Grammar","Data Change Delta Table"," |
| 3402 |
{ OLD | NEW | FINAL } TABLE |
| 3403 |
( { insert | update | delete | @h2@ { mergeInto } | mergeUsing } ) |
| 3404 |
"," |
| 3405 |
Executes the inner data change command and returns old, new, or final rows. |
| 3406 |
|
| 3407 |
""OLD"" is not allowed for ""INSERT"" command. It returns old rows. |
| 3408 |
|
| 3409 |
""NEW"" and ""FINAL"" are not allowed for ""DELETE"" command. |
| 3410 |
|
| 3411 |
""NEW"" returns new rows after evaluation of default expressions, but before execution of triggers. |
| 3412 |
|
| 3413 |
""FINAL"" returns new rows after execution of triggers. |
| 3414 |
"," |
| 3415 |
SELECT ID FROM FINAL TABLE (INSERT INTO TEST (A, B) VALUES (1, 2)) |
| 3416 |
" |
| 3417 |
|
| 3418 |
"Other Grammar","Data Type or Domain"," |
| 3419 |
dataType | [schemaName.]domainName |
| 3420 |
"," |
| 3421 |
A data type or domain name. |
| 3422 |
"," |
| 3423 |
INTEGER |
| 3424 |
MY_DOMAIN |
| 3425 |
" |
| 3426 |
|
| 3427 |
"Other Grammar","Data Type"," |
| 3428 |
predefinedType | arrayType | rowType |
| 3429 |
"," |
| 3430 |
A data type. |
| 3431 |
"," |
| 3432 |
INTEGER |
| 3433 |
" |
| 3434 |
|
| 3435 |
"Other Grammar","Predefined Type"," |
| 3436 |
characterType | characterVaryingType | characterLargeObjectType |
| 3437 |
| binaryType | binaryVaryingType | binaryLargeObjectType |
| 3438 |
| booleanType |
| 3439 |
| smallintType | integerType | bigintType |
| 3440 |
| numericType | realType | doublePrecisionType | decfloatType |
| 3441 |
| dateType | timeType | timeWithTimeZoneType |
| 3442 |
| timestampType | timestampWithTimeZoneType |
| 3443 |
| intervalType |
| 3444 |
| @h2@ { tinyintType | javaObjectType | enumType |
| 3445 |
| geometryType | jsonType | uuidType } |
| 3446 |
"," |
| 3447 |
A predefined data type. |
| 3448 |
"," |
| 3449 |
INTEGER |
| 3450 |
" |
| 3451 |
|
| 3452 |
"Other Grammar","Digit"," |
| 3453 |
0-9 |
| 3454 |
"," |
| 3455 |
A digit. |
| 3456 |
"," |
| 3457 |
0 |
| 3458 |
" |
| 3459 |
|
| 3460 |
"Other Grammar","Expression"," |
| 3461 |
andCondition [ { OR andCondition } [...] ] |
| 3462 |
"," |
| 3463 |
Value or condition. |
| 3464 |
"," |
| 3465 |
ID=1 OR NAME='Hi' |
| 3466 |
" |
| 3467 |
|
| 3468 |
"Other Grammar","Factor"," |
| 3469 |
term [ { { * | / | @c@ { % } } term } [...] ] |
| 3470 |
"," |
| 3471 |
A value or a numeric factor. |
| 3472 |
"," |
| 3473 |
ID * 10 |
| 3474 |
" |
| 3475 |
|
| 3476 |
"Other Grammar","Grouping element"," |
| 3477 |
expression | (expression [, ...]) | () |
| 3478 |
"," |
| 3479 |
A grouping element of GROUP BY clause. |
| 3480 |
"," |
| 3481 |
A |
| 3482 |
(B, C) |
| 3483 |
() |
| 3484 |
" |
| 3485 |
|
| 3486 |
"Other Grammar","Hex"," |
| 3487 |
[' ' [...]] { { digit | a-f | A-F } [' ' [...]] { digit | a-f | A-F } [' ' [...]] } [...] |
| 3488 |
"," |
| 3489 |
The hexadecimal representation of a number or of bytes with optional space characters. |
| 3490 |
Two hexadecimal digit characters are one byte. |
| 3491 |
"," |
| 3492 |
cafe |
| 3493 |
11 22 33 |
| 3494 |
a b c d |
| 3495 |
" |
| 3496 |
|
| 3497 |
"Other Grammar","Index Column"," |
| 3498 |
columnName [ ASC | DESC ] [ NULLS { FIRST | LAST } ] |
| 3499 |
"," |
| 3500 |
Indexes this column in ascending or descending order. Usually it is not required |
| 3501 |
to specify the order; however doing so will speed up large queries that order |
| 3502 |
the column in the same way. |
| 3503 |
"," |
| 3504 |
NAME |
| 3505 |
" |
| 3506 |
|
| 3507 |
"Other Grammar","Insert values"," |
| 3508 |
VALUES { DEFAULT|expression | [ROW] ({DEFAULT|expression} [,...]) }, [,...] |
| 3509 |
"," |
| 3510 |
Values for INSERT statement. |
| 3511 |
"," |
| 3512 |
VALUES (1, 'Test') |
| 3513 |
" |
| 3514 |
|
| 3515 |
"Other Grammar","Interval qualifier"," |
| 3516 |
YEAR [(precisionInt)] [ TO MONTH ] |
| 3517 |
| MONTH [(precisionInt)] |
| 3518 |
| DAY [(precisionInt)] [ TO { HOUR | MINUTE | SECOND [(scaleInt)] } ] |
| 3519 |
| HOUR [(precisionInt)] [ TO { MINUTE | SECOND [(scaleInt)] } ] |
| 3520 |
| MINUTE [(precisionInt)] [ TO SECOND [(scaleInt)] ] |
| 3521 |
| SECOND [(precisionInt [, scaleInt])] |
| 3522 |
"," |
| 3523 |
An interval qualifier. |
| 3524 |
"," |
| 3525 |
DAY TO SECOND |
| 3526 |
" |
| 3527 |
|
| 3528 |
"Other Grammar","Join specification"," |
| 3529 |
ON expression | USING (columnName [,...]) |
| 3530 |
"," |
| 3531 |
Specifies a join condition or column names. |
| 3532 |
"," |
| 3533 |
ON B.ID = A.PARENT_ID |
| 3534 |
USING (ID) |
| 3535 |
" |
| 3536 |
|
| 3537 |
"Other Grammar","Merge when clause"," |
| 3538 |
mergeWhenMatchedClause|mergeWhenNotMatchedClause |
| 3539 |
"," |
| 3540 |
WHEN MATCHED or WHEN NOT MATCHED clause for MERGE USING command. |
| 3541 |
"," |
| 3542 |
WHEN MATCHED THEN DELETE |
| 3543 |
" |
| 3544 |
|
| 3545 |
"Other Grammar","Merge when matched clause"," |
| 3546 |
WHEN MATCHED [ AND expression ] THEN |
| 3547 |
UPDATE SET setClauseList | DELETE |
| 3548 |
"," |
| 3549 |
WHEN MATCHED clause for MERGE USING command. |
| 3550 |
"," |
| 3551 |
WHEN MATCHED THEN UPDATE SET NAME = S.NAME |
| 3552 |
WHEN MATCHED THEN DELETE |
| 3553 |
" |
| 3554 |
|
| 3555 |
"Other Grammar","Merge when not matched clause"," |
| 3556 |
WHEN NOT MATCHED [ AND expression ] THEN INSERT |
| 3557 |
[ ( columnName [,...] ) ] |
| 3558 |
[ overrideClause ] |
| 3559 |
VALUES ({DEFAULT|expression} [,...]) |
| 3560 |
"," |
| 3561 |
WHEN NOT MATCHED clause for MERGE USING command. |
| 3562 |
"," |
| 3563 |
WHEN NOT MATCHED THEN INSERT (ID, NAME) VALUES (S.ID, S.NAME) |
| 3564 |
" |
| 3565 |
|
| 3566 |
"Other Grammar","Name"," |
| 3567 |
{ { A-Z|_ } [ { A-Z|_|0-9 } [...] ] } | quotedName |
| 3568 |
"," |
| 3569 |
With default settings unquoted names are converted to upper case. |
| 3570 |
The maximum name length is 256 characters. |
| 3571 |
|
| 3572 |
Identifiers in H2 are case sensitive by default. |
| 3573 |
Because unquoted names are converted to upper case, they can be written in any case anyway. |
| 3574 |
When both quoted and unquoted names are used for the same identifier the quoted names must be written in upper case. |
| 3575 |
Identifiers with lowercase characters can be written only as a quoted name, they aren't accessible with unquoted names. |
| 3576 |
|
| 3577 |
If DATABASE_TO_UPPER setting is set to FALSE the unquoted names aren't converted to upper case. |
| 3578 |
|
| 3579 |
If DATABASE_TO_LOWER setting is set to TRUE the unquoted names are converted to lower case instead. |
| 3580 |
|
| 3581 |
If CASE_INSENSITIVE_IDENTIFIERS setting is set to TRUE all identifiers are case insensitive. |
| 3582 |
"," |
| 3583 |
TEST |
| 3584 |
" |
| 3585 |
|
| 3586 |
"Other Grammar","Operand"," |
| 3587 |
summand [ { || summand } [...] ] |
| 3588 |
"," |
| 3589 |
Performs the concatenation of character string, binary string, or array values. |
| 3590 |
In the default mode, the result is NULL if either parameter is NULL. |
| 3591 |
In compatibility modes result of string concatenation with NULL parameter can be different. |
| 3592 |
"," |
| 3593 |
'Hi' || ' Eva' |
| 3594 |
X'AB' || X'CD' |
| 3595 |
ARRAY[1, 2] || 3 |
| 3596 |
1 || ARRAY[2, 3] |
| 3597 |
ARRAY[1, 2] || ARRAY[3, 4] |
| 3598 |
" |
| 3599 |
|
| 3600 |
"Other Grammar","Override clause"," |
| 3601 |
OVERRIDING { USER | SYSTEM } VALUE |
| 3602 |
"," |
| 3603 |
If OVERRIDING USER VALUE is specified, INSERT statement ignores the provided value for identity column |
| 3604 |
and generates a new one instead. |
| 3605 |
|
| 3606 |
If OVERRIDING SYSTEM VALUE is specified, INSERT statement assigns the provided value to identity column. |
| 3607 |
|
| 3608 |
If neither clauses are specified, INSERT statement assigns the provided value to |
| 3609 |
GENERATED BY DEFAULT AS IDENTITY column, |
| 3610 |
but throws an exception if value is specified for GENERATED ALWAYS AS IDENTITY column. |
| 3611 |
"," |
| 3612 |
OVERRIDING SYSTEM VALUE |
| 3613 |
OVERRIDING USER VALUE |
| 3614 |
" |
| 3615 |
|
| 3616 |
"Other Grammar","Query"," |
| 3617 |
select | explicitTable | tableValue |
| 3618 |
"," |
| 3619 |
A query, such as SELECT, explicit table, or table value. |
| 3620 |
"," |
| 3621 |
SELECT ID FROM TEST; |
| 3622 |
TABLE TEST; |
| 3623 |
VALUES (1, 2), (3, 4); |
| 3624 |
" |
| 3625 |
|
| 3626 |
"Other Grammar","Quoted Name"," |
| 3627 |
""anythingExceptDoubleQuote"" |
| 3628 |
| U&""anythingExceptDoubleQuote"" [ UESCAPE 'singleCharacter' ] |
| 3629 |
"," |
| 3630 |
Case of characters in quoted names is preserved as is. Such names can contain spaces. |
| 3631 |
The maximum name length is 256 characters. |
| 3632 |
Two double quotes can be used to create a single double quote inside an identifier. |
| 3633 |
With default settings identifiers in H2 are case sensitive. |
| 3634 |
|
| 3635 |
Identifiers staring with ""U&"" are Unicode identifiers. |
| 3636 |
All identifiers in H2 may have Unicode characters, |
| 3637 |
but Unicode identifiers may contain Unicode escape sequences ""\0000"" or ""\+000000"", |
| 3638 |
where \ is an escape character, ""0000"" and ""000000"" are Unicode character codes in hexadecimal notation. |
| 3639 |
Optional ""UESCAPE"" clause may be used to specify another escape character, |
| 3640 |
with exception for single quote, double quote, plus sign, and hexadecimal digits (0-9, a-f, and A-F). |
| 3641 |
By default the backslash is used. |
| 3642 |
Two escape characters can be used to include a single character inside an Unicode identifier. |
| 3643 |
Two double quotes can be used to create a single double quote inside an Unicode identifier. |
| 3644 |
"," |
| 3645 |
""FirstName"" |
| 3646 |
U&""\00d6ffnungszeit"" |
| 3647 |
U&""/00d6ffnungszeit"" UESCAPE '/' |
| 3648 |
" |
| 3649 |
|
| 3650 |
"Other Grammar","Referential Constraint"," |
| 3651 |
FOREIGN KEY ( columnName [,...] ) referencesSpecification |
| 3652 |
"," |
| 3653 |
Defines a referential constraint. |
| 3654 |
"," |
| 3655 |
FOREIGN KEY(ID) REFERENCES TEST(ID) |
| 3656 |
" |
| 3657 |
|
| 3658 |
"Other Grammar","References Specification"," |
| 3659 |
REFERENCES [ refTableName ] [ ( refColumnName [,...] ) ] |
| 3660 |
[ ON DELETE referentialAction ] [ ON UPDATE referentialAction ] |
| 3661 |
"," |
| 3662 |
Defines a referential specification of a referential constraint. |
| 3663 |
If the table name is not specified, then the same table is referenced. |
| 3664 |
RESTRICT is the default action. |
| 3665 |
If the referenced columns are not specified, then the primary key columns are used. |
| 3666 |
Referential constraint requires an existing unique or primary key constraint on referenced columns, |
| 3667 |
this constraint must include all referenced columns in any order and must not include any other columns. |
| 3668 |
Some tables may not be referenced, such as metadata tables. |
| 3669 |
"," |
| 3670 |
REFERENCES TEST(ID) |
| 3671 |
" |
| 3672 |
|
| 3673 |
"Other Grammar","Referential Action"," |
| 3674 |
CASCADE | RESTRICT | NO ACTION | SET { DEFAULT | NULL } |
| 3675 |
"," |
| 3676 |
The action CASCADE will cause conflicting rows in the referencing (child) table to be deleted or updated. |
| 3677 |
RESTRICT is the default action. |
| 3678 |
As this database does not support deferred checking, RESTRICT and NO ACTION will both throw an exception if the constraint is violated. |
| 3679 |
The action SET DEFAULT will set the column in the referencing (child) table to the default value, while SET NULL will set it to NULL. |
| 3680 |
"," |
| 3681 |
CASCADE |
| 3682 |
SET NULL |
| 3683 |
" |
| 3684 |
|
| 3685 |
"Other Grammar","Script Compression Encryption"," |
| 3686 |
@h2@ [ COMPRESSION { DEFLATE | LZF | ZIP | GZIP } ] |
| 3687 |
@h2@ [ CIPHER cipher PASSWORD string ] |
| 3688 |
"," |
| 3689 |
The compression and encryption algorithm to use for script files. |
| 3690 |
When using encryption, only DEFLATE and LZF are supported. |
| 3691 |
LZF is faster but uses more space. |
| 3692 |
"," |
| 3693 |
COMPRESSION LZF |
| 3694 |
" |
| 3695 |
|
| 3696 |
"Other Grammar","Select order"," |
| 3697 |
{ expression | @c@ { int } } [ ASC | DESC ] [ NULLS { FIRST | LAST } ] |
| 3698 |
"," |
| 3699 |
Sorts the result by the given column number, or by an expression. If the |
| 3700 |
expression is a single parameter, then the value is interpreted as a column |
| 3701 |
number. Negative column numbers reverse the sort order. |
| 3702 |
"," |
| 3703 |
NAME DESC NULLS LAST |
| 3704 |
" |
| 3705 |
|
| 3706 |
"Other Grammar","Row value expression"," |
| 3707 |
ROW (expression, [,...]) |
| 3708 |
| ( [ expression, expression [,...] ] ) |
| 3709 |
| expression |
| 3710 |
"," |
| 3711 |
A row value expression. |
| 3712 |
"," |
| 3713 |
ROW (1) |
| 3714 |
(1, 2) |
| 3715 |
1 |
| 3716 |
" |
| 3717 |
|
| 3718 |
"Other Grammar","Select Expression"," |
| 3719 |
wildcardExpression | expression [ [ AS ] columnAlias ] |
| 3720 |
"," |
| 3721 |
An expression in a SELECT statement. |
| 3722 |
"," |
| 3723 |
ID AS DOCUMENT_ID |
| 3724 |
" |
| 3725 |
|
| 3726 |
"Other Grammar","Sequence value expression"," |
| 3727 |
{ NEXT | @h2@ { CURRENT } } VALUE FOR [schemaName.]sequenceName |
| 3728 |
"," |
| 3729 |
The next or current value of a sequence. |
| 3730 |
|
| 3731 |
When the next value is requested the sequence is incremented and the current value of the sequence |
| 3732 |
and the last identity in the current session are updated with the generated value. |
| 3733 |
The next value of the sequence is generated only once for each processed row. |
| 3734 |
If this expression is used multiple times with the same sequence it returns the same value within a processed row. |
| 3735 |
Used values are never re-used, even when the transaction is rolled back. |
| 3736 |
|
| 3737 |
Current value may only be requested after generation of the sequence value in the current session. |
| 3738 |
It returns the latest generated value for the current session. |
| 3739 |
|
| 3740 |
If a single command contains next and current value expressions for the same sequence there is no guarantee that |
| 3741 |
the next value expression will be evaluated before the evaluation of current value expression. |
| 3742 |
"," |
| 3743 |
NEXT VALUE FOR SEQ1 |
| 3744 |
CURRENT VALUE FOR SCHEMA2.SEQ2 |
| 3745 |
" |
| 3746 |
|
| 3747 |
"Other Grammar","Sequence option"," |
| 3748 |
START WITH long |
| 3749 |
| @h2@ { RESTART WITH long } |
| 3750 |
| basicSequenceOption |
| 3751 |
"," |
| 3752 |
Option of a sequence. |
| 3753 |
|
| 3754 |
START WITH is used to set the initial value of the sequence. |
| 3755 |
If initial value is not defined, MINVALUE for incrementing sequences and MAXVALUE for decrementing sequences is used. |
| 3756 |
|
| 3757 |
RESTART is used to immediately restart the sequence with the specified value. |
| 3758 |
"," |
| 3759 |
START WITH 10000 |
| 3760 |
NO CACHE |
| 3761 |
" |
| 3762 |
|
| 3763 |
"Other Grammar","Alter sequence option"," |
| 3764 |
@h2@ { START WITH long } |
| 3765 |
| RESTART [ WITH long ] |
| 3766 |
| basicSequenceOption |
| 3767 |
"," |
| 3768 |
Option of a sequence. |
| 3769 |
|
| 3770 |
START WITH is used to change the initial value of the sequence. |
| 3771 |
It does not affect the current value of the sequence, |
| 3772 |
it only changes the preserved initial value that is used for simple RESTART without a value. |
| 3773 |
|
| 3774 |
RESTART is used to restart the sequence from its initial value or with the specified value. |
| 3775 |
"," |
| 3776 |
START WITH 10000 |
| 3777 |
NO CACHE |
| 3778 |
" |
| 3779 |
|
| 3780 |
"Other Grammar","Alter identity column option"," |
| 3781 |
@h2@ { START WITH long } |
| 3782 |
| RESTART [ WITH long ] |
| 3783 |
| SET basicSequenceOption |
| 3784 |
"," |
| 3785 |
Option of an identity column. |
| 3786 |
|
| 3787 |
START WITH is used to set or change the initial value of the sequence. |
| 3788 |
START WITH does not affect the current value of the sequence, |
| 3789 |
it only changes the preserved initial value that is used for simple RESTART without a value. |
| 3790 |
|
| 3791 |
RESTART is used to restart the sequence from its initial value or with the specified value. |
| 3792 |
"," |
| 3793 |
START WITH 10000 |
| 3794 |
SET NO CACHE |
| 3795 |
" |
| 3796 |
|
| 3797 |
"Other Grammar","Basic sequence option"," |
| 3798 |
INCREMENT BY long |
| 3799 |
| MINVALUE long | NO MINVALUE | @c@ { NOMINVALUE } |
| 3800 |
| MAXVALUE long | NO MAXVALUE | @c@ { NOMAXVALUE } |
| 3801 |
| CYCLE | NO CYCLE | @h2@ { EXHAUSTED } | @c@ { NOCYCLE } |
| 3802 |
| @h2@ { CACHE long } | @h2@ { NO CACHE } | @c@ { NOCACHE } |
| 3803 |
"," |
| 3804 |
Basic option of a sequence. |
| 3805 |
|
| 3806 |
INCREMENT BY specifies the step of the sequence, may be positive or negative, but may not be zero. |
| 3807 |
The default is 1. |
| 3808 |
|
| 3809 |
MINVALUE and MAXVALUE specify the bounds of the sequence. |
| 3810 |
|
| 3811 |
Sequences with CYCLE option start the generation again from |
| 3812 |
MINVALUE (incrementing sequences) or MAXVALUE (decrementing sequences) instead of exhausting with an error. |
| 3813 |
Sequences with EXHAUSTED option can't return values until they will be restarted. |
| 3814 |
|
| 3815 |
The CACHE option sets the number of pre-allocated numbers. |
| 3816 |
If the system crashes without closing the database, at most this many numbers are lost. |
| 3817 |
The default cache size is 32 if sequence has enough range of values. |
| 3818 |
NO CACHE option or the cache size 1 or lower disable the cache. |
| 3819 |
If CACHE option is specified, it cannot be larger than the total number of values |
| 3820 |
that sequence can produce within a cycle. |
| 3821 |
"," |
| 3822 |
MAXVALUE 100000 |
| 3823 |
CYCLE |
| 3824 |
NO CACHE |
| 3825 |
" |
| 3826 |
|
| 3827 |
"Other Grammar","Set clause list"," |
| 3828 |
{ { updateTarget = { DEFAULT | expression } } |
| 3829 |
| { ( updateTarget [,...] ) = { rowValueExpression | (query) } } } [,...] |
| 3830 |
"," |
| 3831 |
List of SET clauses. |
| 3832 |
|
| 3833 |
Each column may be specified only once in update targets. |
| 3834 |
"," |
| 3835 |
NAME = 'Test', PRICE = 2 |
| 3836 |
(A, B) = (1, 2) |
| 3837 |
(A, B) = (1, 2), C = 3 |
| 3838 |
(A, B) = (SELECT X, Y FROM OTHER T2 WHERE T1.ID = T2.ID) |
| 3839 |
" |
| 3840 |
|
| 3841 |
"Other Grammar","Sort specification"," |
| 3842 |
expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ] |
| 3843 |
"," |
| 3844 |
Sorts the result by an expression. |
| 3845 |
"," |
| 3846 |
X ASC NULLS FIRST |
| 3847 |
" |
| 3848 |
|
| 3849 |
"Other Grammar","Sort specification list"," |
| 3850 |
sortSpecification [,...] |
| 3851 |
"," |
| 3852 |
Sorts the result by expressions. |
| 3853 |
"," |
| 3854 |
V |
| 3855 |
A, B DESC NULLS FIRST |
| 3856 |
" |
| 3857 |
|
| 3858 |
"Other Grammar","Summand"," |
| 3859 |
factor [ { { + | - } factor } [...] ] |
| 3860 |
"," |
| 3861 |
A value or a numeric sum. |
| 3862 |
|
| 3863 |
Please note the text concatenation operator is ""||"". |
| 3864 |
"," |
| 3865 |
ID + 20 |
| 3866 |
" |
| 3867 |
|
| 3868 |
"Other Grammar","Table Expression"," |
| 3869 |
{ [ schemaName. ] tableName |
| 3870 |
| ( query ) |
| 3871 |
| unnest |
| 3872 |
| table |
| 3873 |
| dataChangeDeltaTable } |
| 3874 |
[ [ AS ] newTableAlias [ ( columnName [,...] ) ] ] |
| 3875 |
@h2@ [ USE INDEX ([ indexName [,...] ]) ] |
| 3876 |
[ { { LEFT | RIGHT } [ OUTER ] | [ INNER ] | CROSS | NATURAL } |
| 3877 |
JOIN tableExpression [ joinSpecification ] ] |
| 3878 |
"," |
| 3879 |
Joins a table. The join specification is not supported for cross and natural joins. |
| 3880 |
A natural join is an inner join, where the condition is automatically on the |
| 3881 |
columns with the same name. |
| 3882 |
"," |
| 3883 |
TEST1 AS T1 LEFT JOIN TEST2 AS T2 ON T1.ID = T2.PARENT_ID |
| 3884 |
" |
| 3885 |
|
| 3886 |
"Other Grammar","Update target"," |
| 3887 |
columnName [ '[' int ']' [...] ] |
| 3888 |
"," |
| 3889 |
Column or element of a column of ARRAY data type. |
| 3890 |
|
| 3891 |
If array indexes are specified, |
| 3892 |
column must have a compatible ARRAY data type and updated rows may not have NULL values in this column. |
| 3893 |
It means for C[2][3] both C and C[2] may not be NULL. |
| 3894 |
Too short arrays are expanded, missing elements are set to NULL. |
| 3895 |
"," |
| 3896 |
A |
| 3897 |
B[1] |
| 3898 |
C[2][3] |
| 3899 |
" |
| 3900 |
|
| 3901 |
"Other Grammar","Within group specification"," |
| 3902 |
WITHIN GROUP (ORDER BY sortSpecificationList) |
| 3903 |
"," |
| 3904 |
Group specification for ordered set functions. |
| 3905 |
"," |
| 3906 |
WITHIN GROUP (ORDER BY ID DESC) |
| 3907 |
" |
| 3908 |
|
| 3909 |
"Other Grammar","Wildcard expression"," |
| 3910 |
[[schemaName.]tableAlias.]* |
| 3911 |
@h2@ [EXCEPT ([[schemaName.]tableAlias.]columnName, [,...])] |
| 3912 |
"," |
| 3913 |
A wildcard expression in a SELECT statement. |
| 3914 |
A wildcard expression represents all visible columns. Some columns can be excluded with optional EXCEPT clause. |
| 3915 |
"," |
| 3916 |
* |
| 3917 |
* EXCEPT (DATA) |
| 3918 |
" |
| 3919 |
|
| 3920 |
"Other Grammar","Window name or specification"," |
| 3921 |
windowName | windowSpecification |
| 3922 |
"," |
| 3923 |
A window name or inline specification for a window function or aggregate. |
| 3924 |
|
| 3925 |
Window functions in H2 may require a lot of memory for large queries. |
| 3926 |
"," |
| 3927 |
W1 |
| 3928 |
(ORDER BY ID) |
| 3929 |
" |
| 3930 |
|
| 3931 |
"Other Grammar","Window specification"," |
| 3932 |
([existingWindowName] |
| 3933 |
[PARTITION BY expression [,...]] [ORDER BY sortSpecificationList] |
| 3934 |
[windowFrame]) |
| 3935 |
"," |
| 3936 |
A window specification for a window, window function or aggregate. |
| 3937 |
|
| 3938 |
If name of an existing window is specified its clauses are used by default. |
| 3939 |
|
| 3940 |
Optional window partition clause separates rows into independent partitions. |
| 3941 |
Each partition is processed separately. |
| 3942 |
If this clause is not present there is one implicit partition with all rows. |
| 3943 |
|
| 3944 |
Optional window order clause specifies order of rows in the partition. |
| 3945 |
If some rows have the same order position they are considered as a group of rows in optional window frame clause. |
| 3946 |
|
| 3947 |
Optional window frame clause specifies which rows are processed by a window function, |
| 3948 |
see its documentation for a more details. |
| 3949 |
"," |
| 3950 |
() |
| 3951 |
(W1 ORDER BY ID) |
| 3952 |
(PARTITION BY CATEGORY) |
| 3953 |
(PARTITION BY CATEGORY ORDER BY NAME, ID) |
| 3954 |
(ORDER BY Y RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) |
| 3955 |
" |
| 3956 |
|
| 3957 |
"Other Grammar","Window frame"," |
| 3958 |
ROWS|RANGE|GROUP |
| 3959 |
{windowFramePreceding|BETWEEN windowFrameBound AND windowFrameBound} |
| 3960 |
[EXCLUDE {CURRENT ROW|GROUP|TIES|NO OTHERS}] |
| 3961 |
"," |
| 3962 |
A window frame clause. |
| 3963 |
May be specified only for aggregates and FIRST_VALUE(), LAST_VALUE(), and NTH_VALUE() window functions. |
| 3964 |
|
| 3965 |
If this clause is not specified for an aggregate or window function that supports this clause |
| 3966 |
the default window frame depends on window order clause. |
| 3967 |
If window order clause is also not specified |
| 3968 |
the default window frame contains all the rows in the partition. |
| 3969 |
If window order clause is specified |
| 3970 |
the default window frame contains all preceding rows and all rows from the current group. |
| 3971 |
|
| 3972 |
Window frame unit determines how rows or groups of rows are selected and counted. |
| 3973 |
If ROWS is specified rows are not grouped in any way and relative numbers of rows are used in bounds. |
| 3974 |
If RANGE is specified rows are grouped according window order clause, |
| 3975 |
preceding and following values mean the difference between value in the current row and in the target rows, |
| 3976 |
and CURRENT ROW in bound specification means current group of rows. |
| 3977 |
If GROUPS is specified rows are grouped according window order clause, |
| 3978 |
preceding and following values means relative number of groups of rows, |
| 3979 |
and CURRENT ROW in bound specification means current group of rows. |
| 3980 |
|
| 3981 |
If only window frame preceding clause is specified it is treated as |
| 3982 |
BETWEEN windowFramePreceding AND CURRENT ROW. |
| 3983 |
|
| 3984 |
Optional window frame exclusion clause specifies rows that should be excluded from the frame. |
| 3985 |
EXCLUDE CURRENT ROW excludes only the current row regardless the window frame unit. |
| 3986 |
EXCLUDE GROUP excludes the whole current group of rows, including the current row. |
| 3987 |
EXCLUDE TIES excludes the current group of rows, but not the current row. |
| 3988 |
EXCLUDE NO OTHERS is default and it does not exclude anything. |
| 3989 |
"," |
| 3990 |
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES |
| 3991 |
" |
| 3992 |
|
| 3993 |
"Other Grammar","Window frame preceding"," |
| 3994 |
UNBOUNDED PRECEDING|value PRECEDING|CURRENT ROW |
| 3995 |
"," |
| 3996 |
A window frame preceding clause. |
| 3997 |
If value is specified it should not be negative. |
| 3998 |
"," |
| 3999 |
UNBOUNDED PRECEDING |
| 4000 |
1 PRECEDING |
| 4001 |
CURRENT ROW |
| 4002 |
" |
| 4003 |
|
| 4004 |
"Other Grammar","Window frame bound"," |
| 4005 |
UNBOUNDED PRECEDING|value PRECEDING|CURRENT ROW |
| 4006 |
|value FOLLOWING|UNBOUNDED FOLLOWING |
| 4007 |
"," |
| 4008 |
A window frame bound clause. |
| 4009 |
If value is specified it should not be negative. |
| 4010 |
"," |
| 4011 |
UNBOUNDED PRECEDING |
| 4012 |
UNBOUNDED FOLLOWING |
| 4013 |
1 FOLLOWING |
| 4014 |
CURRENT ROW |
| 4015 |
" |
| 4016 |
|
| 4017 |
"Other Grammar","Term"," |
| 4018 |
{ value |
| 4019 |
| column |
| 4020 |
| ?[ int ] |
| 4021 |
| sequenceValueExpression |
| 4022 |
| function |
| 4023 |
| { - | + } term |
| 4024 |
| ( expression ) |
| 4025 |
| arrayElementReference |
| 4026 |
| fieldReference |
| 4027 |
| ( query ) |
| 4028 |
| caseExpression |
| 4029 |
| castSpecification |
| 4030 |
| userDefinedFunctionName } |
| 4031 |
[ timeZone | intervalQualifier ] |
| 4032 |
"," |
| 4033 |
A value. Parameters can be indexed, for example ""?1"" meaning the first parameter. |
| 4034 |
|
| 4035 |
Interval qualifier may only be specified for a compatible value |
| 4036 |
or for a subtraction operation between two datetime values. |
| 4037 |
The subtraction operation ignores the leading field precision of the qualifier. |
| 4038 |
"," |
| 4039 |
'Hello' |
| 4040 |
|
| 4041 |
" |
| 4042 |
|
| 4043 |
"Other Grammar","Time zone"," |
| 4044 |
AT { TIME ZONE { intervalHourToMinute | intervalHourToSecond | @h2@ { string } } | LOCAL } |
| 4045 |
"," |
| 4046 |
A time zone. Converts the timestamp with or without time zone into timestamp with time zone at specified time zone. |
| 4047 |
If a day-time interval is specified as a time zone, |
| 4048 |
it may not have fractional seconds and must be between -18 to 18 hours inclusive. |
| 4049 |
"," |
| 4050 |
AT LOCAL |
| 4051 |
AT TIME ZONE '2' |
| 4052 |
AT TIME ZONE '-6:00' |
| 4053 |
AT TIME ZONE INTERVAL '10:00' HOUR TO MINUTE |
| 4054 |
AT TIME ZONE INTERVAL '10:00:00' HOUR TO SECOND |
| 4055 |
AT TIME ZONE 'UTC' |
| 4056 |
AT TIME ZONE 'Europe/London' |
| 4057 |
" |
| 4058 |
|
| 4059 |
"Other Grammar","Column"," |
| 4060 |
[[schemaName.]tableAlias.] { columnName | @h2@ { _ROWID_ } } |
| 4061 |
"," |
| 4062 |
A column name with optional table alias and schema. |
| 4063 |
_ROWID_ can be used to access unique row identifier. |
| 4064 |
"," |
| 4065 |
ID |
| 4066 |
" |
| 4067 |
|
| 4068 |
"Data Types","CHARACTER Type"," |
| 4069 |
{ CHARACTER | CHAR | NATIONAL { CHARACTER | CHAR } | NCHAR } |
| 4070 |
[ ( lengthInt [CHARACTERS|OCTETS] ) ] |
| 4071 |
"," |
| 4072 |
A Unicode String of fixed length. |
| 4073 |
|
| 4074 |
Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2. |
| 4075 |
The allowed length is from 1 to 1,000,000,000 characters. |
| 4076 |
If length is not specified, 1 character is used by default. |
| 4077 |
|
| 4078 |
The whole text is kept in memory when using this data type. |
| 4079 |
For variable-length strings use [CHARACTER VARYING](https://h2database.com/html/datatypes.html#character_varying_type) |
| 4080 |
data type instead. |
| 4081 |
For large text data [CHARACTER LARGE OBJECT](https://h2database.com/html/datatypes.html#character_large_object_type) |
| 4082 |
should be used; see there for details. |
| 4083 |
|
| 4084 |
Too short strings are right-padded with space characters. |
| 4085 |
Too long strings are truncated by CAST specification and rejected by column assignment. |
| 4086 |
|
| 4087 |
Two CHARACTER strings of different length are considered as equal if all additional characters in the longer string |
| 4088 |
are space characters. |
| 4089 |
|
| 4090 |
See also [string](https://h2database.com/html/grammar.html#string) literal grammar. |
| 4091 |
Mapped to ""java.lang.String"". |
| 4092 |
"," |
| 4093 |
CHARACTER |
| 4094 |
CHAR(10) |
| 4095 |
" |
| 4096 |
|
| 4097 |
"Data Types","CHARACTER VARYING Type"," |
| 4098 |
{ { CHARACTER | CHAR } VARYING |
| 4099 |
| VARCHAR |
| 4100 |
| { NATIONAL { CHARACTER | CHAR } | NCHAR } VARYING |
| 4101 |
| @h2@ { VARCHAR_CASESENSITIVE } } |
| 4102 |
[ ( lengthInt [CHARACTERS|OCTETS] ) ] |
| 4103 |
"," |
| 4104 |
A Unicode String. |
| 4105 |
Use two single quotes ('') to create a quote. |
| 4106 |
|
| 4107 |
The allowed length is from 1 to 1,000,000,000 characters. |
| 4108 |
The length is a size constraint; only the actual data is persisted. |
| 4109 |
Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2. |
| 4110 |
|
| 4111 |
The whole text is loaded into memory when using this data type. |
| 4112 |
For large text data [CHARACTER LARGE OBJECT](https://h2database.com/html/datatypes.html#character_large_object_type) |
| 4113 |
should be used; see there for details. |
| 4114 |
|
| 4115 |
See also [string](https://h2database.com/html/grammar.html#string) literal grammar. |
| 4116 |
Mapped to ""java.lang.String"". |
| 4117 |
"," |
| 4118 |
CHARACTER VARYING(100) |
| 4119 |
VARCHAR(255) |
| 4120 |
" |
| 4121 |
|
| 4122 |
"Data Types","CHARACTER LARGE OBJECT Type"," |
| 4123 |
{ { CHARACTER | CHAR } LARGE OBJECT | CLOB |
| 4124 |
| { NATIONAL CHARACTER | NCHAR } LARGE OBJECT | NCLOB } |
| 4125 |
[ ( lengthLong [K|M|G|T|P] [CHARACTERS|OCTETS]) ] |
| 4126 |
"," |
| 4127 |
CHARACTER LARGE OBJECT is intended for very large Unicode character string values. |
| 4128 |
Unlike when using [CHARACTER VARYING](https://h2database.com/html/datatypes.html#character_varying_type), |
| 4129 |
large CHARACTER LARGE OBJECT values are not kept fully in-memory; instead, they are streamed. |
| 4130 |
CHARACTER LARGE OBJECT should be used for documents and texts with arbitrary size such as XML or |
| 4131 |
HTML documents, text files, or memo fields of unlimited size. |
| 4132 |
Use ""PreparedStatement.setCharacterStream"" to store values. |
| 4133 |
See also [Large Objects](https://h2database.com/html/advanced.html#large_objects) section. |
| 4134 |
|
| 4135 |
CHARACTER VARYING should be used for text with relatively short average size (for example |
| 4136 |
shorter than 200 characters). Short CHARACTER LARGE OBJECT values are stored inline, but there is |
| 4137 |
an overhead compared to CHARACTER VARYING. |
| 4138 |
|
| 4139 |
Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2. |
| 4140 |
|
| 4141 |
Mapped to ""java.sql.Clob"" (""java.io.Reader"" is also supported). |
| 4142 |
"," |
| 4143 |
CHARACTER LARGE OBJECT |
| 4144 |
CLOB(10K) |
| 4145 |
" |
| 4146 |
|
| 4147 |
"Data Types","VARCHAR_IGNORECASE Type"," |
| 4148 |
@h2@ VARCHAR_IGNORECASE |
| 4149 |
[ ( lengthInt [CHARACTERS|OCTETS] ) ] |
| 4150 |
"," |
| 4151 |
Same as VARCHAR, but not case sensitive when comparing. |
| 4152 |
Stored in mixed case. |
| 4153 |
|
| 4154 |
The allowed length is from 1 to 1,000,000,000 characters. |
| 4155 |
The length is a size constraint; only the actual data is persisted. |
| 4156 |
Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2. |
| 4157 |
|
| 4158 |
The whole text is loaded into memory when using this data type. |
| 4159 |
For large text data CLOB should be used; see there for details. |
| 4160 |
|
| 4161 |
See also [string](https://h2database.com/html/grammar.html#string) literal grammar. |
| 4162 |
Mapped to ""java.lang.String"". |
| 4163 |
"," |
| 4164 |
VARCHAR_IGNORECASE |
| 4165 |
" |
| 4166 |
|
| 4167 |
"Data Types","BINARY Type"," |
| 4168 |
BINARY [ ( lengthInt ) ] |
| 4169 |
"," |
| 4170 |
Represents a binary string (byte array) of fixed predefined length. |
| 4171 |
|
| 4172 |
The allowed length is from 1 to 1,000,000,000 bytes. |
| 4173 |
If length is not specified, 1 byte is used by default. |
| 4174 |
|
| 4175 |
The whole binary string is kept in memory when using this data type. |
| 4176 |
For variable-length binary strings use [BINARY VARYING](https://h2database.com/html/datatypes.html#binary_varying_type) |
| 4177 |
data type instead. |
| 4178 |
For large binary data [BINARY LARGE OBJECT](https://h2database.com/html/datatypes.html#binary_large_object_type) |
| 4179 |
should be used; see there for details. |
| 4180 |
|
| 4181 |
Too short binary string are right-padded with zero bytes. |
| 4182 |
Too long binary strings are truncated by CAST specification and rejected by column assignment. |
| 4183 |
|
| 4184 |
Binary strings of different length are considered as not equal to each other. |
| 4185 |
|
| 4186 |
See also [bytes](https://h2database.com/html/grammar.html#bytes) literal grammar. |
| 4187 |
Mapped to byte[]. |
| 4188 |
"," |
| 4189 |
BINARY |
| 4190 |
BINARY(1000) |
| 4191 |
" |
| 4192 |
|
| 4193 |
"Data Types","BINARY VARYING Type"," |
| 4194 |
{ BINARY VARYING | VARBINARY } |
| 4195 |
[ ( lengthInt ) ] |
| 4196 |
"," |
| 4197 |
Represents a byte array. |
| 4198 |
|
| 4199 |
The allowed length is from 1 to 1,000,000,000 bytes. |
| 4200 |
The length is a size constraint; only the actual data is persisted. |
| 4201 |
|
| 4202 |
The whole binary string is kept in memory when using this data type. |
| 4203 |
For large binary data [BINARY LARGE OBJECT](https://h2database.com/html/datatypes.html#binary_large_object_type) |
| 4204 |
should be used; see there for details. |
| 4205 |
|
| 4206 |
See also [bytes](https://h2database.com/html/grammar.html#bytes) literal grammar. |
| 4207 |
Mapped to byte[]. |
| 4208 |
"," |
| 4209 |
BINARY VARYING(100) |
| 4210 |
VARBINARY(1000) |
| 4211 |
" |
| 4212 |
|
| 4213 |
"Data Types","BINARY LARGE OBJECT Type"," |
| 4214 |
{ BINARY LARGE OBJECT | BLOB } |
| 4215 |
[ ( lengthLong [K|M|G|T|P]) ] |
| 4216 |
"," |
| 4217 |
BINARY LARGE OBJECT is intended for very large binary values such as files or images. |
| 4218 |
Unlike when using [BINARY VARYING](https://h2database.com/html/datatypes.html#binary_varying_type), |
| 4219 |
large objects are not kept fully in-memory; instead, they are streamed. |
| 4220 |
Use ""PreparedStatement.setBinaryStream"" to store values. |
| 4221 |
See also [CHARACTER LARGE OBJECT](https://h2database.com/html/datatypes.html#character_large_object_type) |
| 4222 |
and [Large Objects](https://h2database.com/html/advanced.html#large_objects) section. |
| 4223 |
|
| 4224 |
Mapped to ""java.sql.Blob"" (""java.io.InputStream"" is also supported). |
| 4225 |
"," |
| 4226 |
BINARY LARGE OBJECT |
| 4227 |
BLOB(10K) |
| 4228 |
" |
| 4229 |
|
| 4230 |
"Data Types","BOOLEAN Type"," |
| 4231 |
BOOLEAN |
| 4232 |
"," |
| 4233 |
Possible values: TRUE, FALSE, and UNKNOWN (NULL). |
| 4234 |
|
| 4235 |
See also [boolean](https://h2database.com/html/grammar.html#boolean) literal grammar. |
| 4236 |
Mapped to ""java.lang.Boolean"". |
| 4237 |
"," |
| 4238 |
BOOLEAN |
| 4239 |
" |
| 4240 |
|
| 4241 |
"Data Types","TINYINT Type"," |
| 4242 |
@h2@ TINYINT |
| 4243 |
"," |
| 4244 |
Possible values are: -128 to 127. |
| 4245 |
|
| 4246 |
See also [integer](https://h2database.com/html/grammar.html#int) literal grammar. |
| 4247 |
|
| 4248 |
In JDBC this data type is mapped to ""java.lang.Integer"". |
| 4249 |
""java.lang.Byte"" is also supported. |
| 4250 |
|
| 4251 |
In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger"" |
| 4252 |
this data type is mapped to ""java.lang.Byte"". |
| 4253 |
|
| 4254 |
"," |
| 4255 |
TINYINT |
| 4256 |
" |
| 4257 |
|
| 4258 |
"Data Types","SMALLINT Type"," |
| 4259 |
SMALLINT |
| 4260 |
"," |
| 4261 |
Possible values: -32768 to 32767. |
| 4262 |
|
| 4263 |
See also [integer](https://h2database.com/html/grammar.html#int) literal grammar. |
| 4264 |
|
| 4265 |
In JDBC this data type is mapped to ""java.lang.Integer"". |
| 4266 |
""java.lang.Short"" is also supported. |
| 4267 |
|
| 4268 |
In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger"" |
| 4269 |
this data type is mapped to ""java.lang.Short"". |
| 4270 |
"," |
| 4271 |
SMALLINT |
| 4272 |
" |
| 4273 |
|
| 4274 |
"Data Types","INTEGER Type"," |
| 4275 |
INTEGER | INT |
| 4276 |
"," |
| 4277 |
Possible values: -2147483648 to 2147483647. |
| 4278 |
|
| 4279 |
See also [integer](https://h2database.com/html/grammar.html#int) literal grammar. |
| 4280 |
Mapped to ""java.lang.Integer"". |
| 4281 |
"," |
| 4282 |
INTEGER |
| 4283 |
INT |
| 4284 |
" |
| 4285 |
|
| 4286 |
"Data Types","BIGINT Type"," |
| 4287 |
BIGINT |
| 4288 |
"," |
| 4289 |
Possible values: -9223372036854775808 to 9223372036854775807. |
| 4290 |
|
| 4291 |
See also [long](https://h2database.com/html/grammar.html#long) literal grammar. |
| 4292 |
Mapped to ""java.lang.Long"". |
| 4293 |
"," |
| 4294 |
BIGINT |
| 4295 |
" |
| 4296 |
|
| 4297 |
"Data Types","NUMERIC Type"," |
| 4298 |
{ NUMERIC | DECIMAL | DEC } [ ( precisionInt [ , scaleInt ] ) ] |
| 4299 |
"," |
| 4300 |
Data type with fixed decimal precision and scale. |
| 4301 |
This data type is recommended for storing currency values. |
| 4302 |
|
| 4303 |
If precision is specified, it must be from 1 to 100000. |
| 4304 |
If scale is specified, it must be from 0 to 100000, 0 is default. |
| 4305 |
|
| 4306 |
See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar. |
| 4307 |
Mapped to ""java.math.BigDecimal"". |
| 4308 |
"," |
| 4309 |
NUMERIC(20, 2) |
| 4310 |
" |
| 4311 |
|
| 4312 |
"Data Types","REAL Type"," |
| 4313 |
REAL | FLOAT ( precisionInt ) |
| 4314 |
"," |
| 4315 |
A single precision floating point number. |
| 4316 |
Should not be used to represent currency values, because of rounding problems. |
| 4317 |
Precision value for FLOAT type name should be from 1 to 24. |
| 4318 |
|
| 4319 |
See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar. |
| 4320 |
Mapped to ""java.lang.Float"". |
| 4321 |
"," |
| 4322 |
REAL |
| 4323 |
" |
| 4324 |
|
| 4325 |
"Data Types","DOUBLE PRECISION Type"," |
| 4326 |
DOUBLE PRECISION | FLOAT [ ( precisionInt ) ] |
| 4327 |
"," |
| 4328 |
A double precision floating point number. |
| 4329 |
Should not be used to represent currency values, because of rounding problems. |
| 4330 |
If precision value is specified for FLOAT type name, it should be from 25 to 53. |
| 4331 |
|
| 4332 |
See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar. |
| 4333 |
Mapped to ""java.lang.Double"". |
| 4334 |
"," |
| 4335 |
DOUBLE PRECISION |
| 4336 |
" |
| 4337 |
|
| 4338 |
"Data Types","DECFLOAT Type"," |
| 4339 |
DECFLOAT [ ( precisionInt ) ] |
| 4340 |
"," |
| 4341 |
Decimal floating point number. |
| 4342 |
This data type is not recommended to represent currency values, because of variable scale. |
| 4343 |
|
| 4344 |
If precision is specified, it must be from 1 to 100000. |
| 4345 |
|
| 4346 |
See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar. |
| 4347 |
Mapped to ""java.math.BigDecimal"". |
| 4348 |
There are three special values: 'Infinity', '-Infinity', and 'NaN'. |
| 4349 |
These special values can't be read or set as ""BigDecimal"" values, |
| 4350 |
but they can be read or set using ""java.lang.String"", float, or double. |
| 4351 |
"," |
| 4352 |
DECFLOAT |
| 4353 |
DECFLOAT(20) |
| 4354 |
" |
| 4355 |
|
| 4356 |
"Data Types","DATE Type"," |
| 4357 |
DATE |
| 4358 |
"," |
| 4359 |
The date data type. The proleptic Gregorian calendar is used. |
| 4360 |
|
| 4361 |
See also [date](https://h2database.com/html/grammar.html#date) literal grammar. |
| 4362 |
|
| 4363 |
In JDBC this data type is mapped to ""java.sql.Date"", with the time set to ""00:00:00"" |
| 4364 |
(or to the next possible time if midnight doesn't exist for the given date and time zone due to a daylight saving change). |
| 4365 |
""java.time.LocalDate"" is also supported and recommended. |
| 4366 |
|
| 4367 |
In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger"" |
| 4368 |
this data type is mapped to ""java.time.LocalDate"". |
| 4369 |
|
| 4370 |
If your time zone had LMT (local mean time) in the past and you use such old dates |
| 4371 |
(depends on the time zone, usually 100 or more years ago), |
| 4372 |
don't use ""java.sql.Date"" to read and write them. |
| 4373 |
|
| 4374 |
If you deal with very old dates (before 1582-10-15) note that ""java.sql.Date"" uses a mixed Julian/Gregorian calendar, |
| 4375 |
""java.util.GregorianCalendar"" can be configured to proleptic Gregorian with |
| 4376 |
""setGregorianChange(new java.util.Date(Long.MIN_VALUE))"" and used to read or write fields of dates. |
| 4377 |
"," |
| 4378 |
DATE |
| 4379 |
" |
| 4380 |
|
| 4381 |
"Data Types","TIME Type"," |
| 4382 |
TIME [ ( precisionInt ) ] [ WITHOUT TIME ZONE ] |
| 4383 |
"," |
| 4384 |
The time data type. The format is hh:mm:ss[.nnnnnnnnn]. |
| 4385 |
If fractional seconds precision is specified it should be from 0 to 9, 0 is default. |
| 4386 |
|
| 4387 |
See also [time](https://h2database.com/html/grammar.html#time) literal grammar. |
| 4388 |
|
| 4389 |
In JDBC this data type is mapped to ""java.sql.Time"". |
| 4390 |
""java.time.LocalTime"" is also supported and recommended. |
| 4391 |
|
| 4392 |
In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger"" |
| 4393 |
this data type is mapped to ""java.time.LocalTime"". |
| 4394 |
|
| 4395 |
Use ""java.time.LocalTime"" or ""String"" instead of ""java.sql.Time"" when non-zero precision is needed. |
| 4396 |
Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up; |
| 4397 |
if result of rounding is higher than maximum supported value 23:59:59.999999999 the value is rounded down instead. |
| 4398 |
The CAST operation to TIMESTAMP and TIMESTAMP WITH TIME ZONE data types uses the |
| 4399 |
[CURRENT_DATE](https://h2database.com/html/functions.html#current_date) for date fields. |
| 4400 |
"," |
| 4401 |
TIME |
| 4402 |
TIME(9) |
| 4403 |
" |
| 4404 |
|
| 4405 |
"Data Types","TIME WITH TIME ZONE Type"," |
| 4406 |
TIME [ ( precisionInt ) ] WITH TIME ZONE |
| 4407 |
"," |
| 4408 |
The time with time zone data type. |
| 4409 |
If fractional seconds precision is specified it should be from 0 to 9, 0 is default. |
| 4410 |
|
| 4411 |
See also [time with time zone](https://h2database.com/html/grammar.html#time_with_time_zone) literal grammar. |
| 4412 |
Mapped to ""java.time.OffsetTime"". |
| 4413 |
Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up; |
| 4414 |
if result of rounding is higher than maximum supported value 23:59:59.999999999 the value is rounded down instead. |
| 4415 |
The CAST operation to TIMESTAMP and TIMESTAMP WITH TIME ZONE data types uses the |
| 4416 |
[CURRENT_DATE](https://h2database.com/html/functions.html#current_date) for date fields. |
| 4417 |
"," |
| 4418 |
TIME WITH TIME ZONE |
| 4419 |
TIME(9) WITH TIME ZONE |
| 4420 |
" |
| 4421 |
|
| 4422 |
"Data Types","TIMESTAMP Type"," |
| 4423 |
TIMESTAMP [ ( precisionInt ) ] [ WITHOUT TIME ZONE ] |
| 4424 |
"," |
| 4425 |
The timestamp data type. The proleptic Gregorian calendar is used. |
| 4426 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 4427 |
|
| 4428 |
This data type holds the local date and time without time zone information. |
| 4429 |
It cannot distinguish timestamps near transitions from DST to normal time. |
| 4430 |
For absolute timestamps use the [TIMESTAMP WITH TIME ZONE](https://h2database.com/html/datatypes.html#timestamp_with_time_zone_type) data type instead. |
| 4431 |
|
| 4432 |
See also [timestamp](https://h2database.com/html/grammar.html#timestamp) literal grammar. |
| 4433 |
|
| 4434 |
In JDBC this data type is mapped to ""java.sql.Timestamp"" (""java.util.Date"" may be used too). |
| 4435 |
""java.time.LocalDateTime"" is also supported and recommended. |
| 4436 |
|
| 4437 |
In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger"" |
| 4438 |
this data type is mapped to ""java.time.LocalDateTime"". |
| 4439 |
|
| 4440 |
If your time zone had LMT (local mean time) in the past and you use such old dates |
| 4441 |
(depends on the time zone, usually 100 or more years ago), |
| 4442 |
don't use ""java.sql.Timestamp"" and ""java.util.Date"" to read and write them. |
| 4443 |
|
| 4444 |
If you deal with very old dates (before 1582-10-15) note that ""java.sql.Timestamp"" and ""java.util.Date"" |
| 4445 |
use a mixed Julian/Gregorian calendar, ""java.util.GregorianCalendar"" can be configured to proleptic Gregorian with |
| 4446 |
""setGregorianChange(new java.util.Date(Long.MIN_VALUE))"" and used to read or write fields of timestamps. |
| 4447 |
|
| 4448 |
Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up. |
| 4449 |
"," |
| 4450 |
TIMESTAMP |
| 4451 |
TIMESTAMP(9) |
| 4452 |
" |
| 4453 |
|
| 4454 |
"Data Types","TIMESTAMP WITH TIME ZONE Type"," |
| 4455 |
TIMESTAMP [ ( precisionInt ) ] WITH TIME ZONE |
| 4456 |
"," |
| 4457 |
The timestamp with time zone data type. The proleptic Gregorian calendar is used. |
| 4458 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 4459 |
|
| 4460 |
See also [timestamp with time zone](https://h2database.com/html/grammar.html#timestamp_with_time_zone) literal grammar. |
| 4461 |
Mapped to ""java.time.OffsetDateTime"". |
| 4462 |
""java.time.ZonedDateTime"" and ""java.time.Instant"" are also supported. |
| 4463 |
|
| 4464 |
Values of this data type are compared by UTC values. It means that ""2010-01-01 10:00:00+01"" is greater than ""2010-01-01 11:00:00+03"". |
| 4465 |
|
| 4466 |
Conversion to ""TIMESTAMP"" uses time zone offset to get UTC time and converts it to local time using the system time zone. |
| 4467 |
Conversion from ""TIMESTAMP"" does the same operations in reverse and sets time zone offset to offset of the system time zone. |
| 4468 |
Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up. |
| 4469 |
"," |
| 4470 |
TIMESTAMP WITH TIME ZONE |
| 4471 |
TIMESTAMP(9) WITH TIME ZONE |
| 4472 |
" |
| 4473 |
|
| 4474 |
"Data Types","INTERVAL Type"," |
| 4475 |
intervalYearType | intervalMonthType | intervalDayType |
| 4476 |
| intervalHourType| intervalMinuteType | intervalSecondType |
| 4477 |
| intervalYearToMonthType | intervalDayToHourType |
| 4478 |
| intervalDayToMinuteType | intervalDayToSecondType |
| 4479 |
| intervalHourToMinuteType | intervalHourToSecondType |
| 4480 |
| intervalMinuteToSecondType |
| 4481 |
"," |
| 4482 |
Interval data type. |
| 4483 |
There are two classes of intervals. Year-month intervals can store years and months. |
| 4484 |
Day-time intervals can store days, hours, minutes, and seconds. |
| 4485 |
Year-month intervals are comparable only with another year-month intervals. |
| 4486 |
Day-time intervals are comparable only with another day-time intervals. |
| 4487 |
|
| 4488 |
Mapped to ""org.h2.api.Interval"". |
| 4489 |
"," |
| 4490 |
INTERVAL DAY TO SECOND |
| 4491 |
" |
| 4492 |
|
| 4493 |
"Data Types","JAVA_OBJECT Type"," |
| 4494 |
@h2@ { JAVA_OBJECT | OBJECT | OTHER } [ ( lengthInt ) ] |
| 4495 |
"," |
| 4496 |
This type allows storing serialized Java objects. Internally, a byte array with serialized form is used. |
| 4497 |
The allowed length is from 1 (useful only with custom serializer) to 1,000,000,000 bytes. |
| 4498 |
The length is a size constraint; only the actual data is persisted. |
| 4499 |
|
| 4500 |
Serialization and deserialization is done on the client side only with two exclusions described below. |
| 4501 |
Deserialization is only done when ""getObject"" is called. |
| 4502 |
Java operations cannot be executed inside the database engine for security reasons. |
| 4503 |
Use ""PreparedStatement.setObject"" with ""Types.JAVA_OBJECT"" or ""H2Type.JAVA_OBJECT"" |
| 4504 |
as a third argument to store values. |
| 4505 |
|
| 4506 |
If Java method alias has ""Object"" parameter(s), values are deserialized during invocation of this method |
| 4507 |
on the server side. |
| 4508 |
|
| 4509 |
If a [linked table](https://h2database.com/html/advanced.html#linked_tables) has a column with ""Types.JAVA_OBJECT"" |
| 4510 |
JDBC data type and its database is not an another H2, Java objects need to be serialized and deserialized during |
| 4511 |
interaction between H2 and database that owns the table on the server side of H2. |
| 4512 |
|
| 4513 |
This data type needs special attention in secure environments. |
| 4514 |
|
| 4515 |
Mapped to ""java.lang.Object"" (or any subclass). |
| 4516 |
"," |
| 4517 |
JAVA_OBJECT |
| 4518 |
JAVA_OBJECT(10000) |
| 4519 |
" |
| 4520 |
|
| 4521 |
"Data Types","ENUM Type"," |
| 4522 |
@h2@ ENUM (string [, ... ]) |
| 4523 |
"," |
| 4524 |
A type with enumerated values. |
| 4525 |
Mapped to ""java.lang.String"". |
| 4526 |
|
| 4527 |
Duplicate and empty values are not permitted. |
| 4528 |
The maximum number of values is 65536. |
| 4529 |
The maximum allowed length of complete data type definition with all values is 1,000,000,000 characters. |
| 4530 |
"," |
| 4531 |
ENUM('clubs', 'diamonds', 'hearts', 'spades') |
| 4532 |
" |
| 4533 |
|
| 4534 |
"Data Types","GEOMETRY Type"," |
| 4535 |
@h2@ GEOMETRY |
| 4536 |
[({ GEOMETRY | |
| 4537 |
{ POINT |
| 4538 |
| LINESTRING |
| 4539 |
| POLYGON |
| 4540 |
| MULTIPOINT |
| 4541 |
| MULTILINESTRING |
| 4542 |
| MULTIPOLYGON |
| 4543 |
| GEOMETRYCOLLECTION } [Z|M|ZM]} |
| 4544 |
[, sridInt] )] |
| 4545 |
"," |
| 4546 |
A spatial geometry type. |
| 4547 |
If additional constraints are not specified this type accepts all supported types of geometries. |
| 4548 |
A constraint with required geometry type and dimension system can be set by specifying name of the type and |
| 4549 |
dimension system. A whitespace between them is optional. |
| 4550 |
2D dimension system does not have a name and assumed if only a geometry type name is specified. |
| 4551 |
POINT means 2D point, POINT Z or POINTZ means 3D point. |
| 4552 |
GEOMETRY constraint means no restrictions on type or dimension system of geometry. |
| 4553 |
A constraint with required spatial reference system identifier (SRID) can be set by specifying this identifier. |
| 4554 |
|
| 4555 |
Mapped to ""org.locationtech.jts.geom.Geometry"" if JTS library is in classpath and to ""java.lang.String"" otherwise. |
| 4556 |
May be represented in textual format using the WKT (well-known text) or EWKT (extended well-known text) format. |
| 4557 |
Values are stored internally in EWKB (extended well-known binary) format, |
| 4558 |
the maximum allowed length is 1,000,000,000 bytes. |
| 4559 |
Only a subset of EWKB and EWKT features is supported. |
| 4560 |
Supported objects are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION. |
| 4561 |
Supported dimension systems are 2D (XY), Z (XYZ), M (XYM), and ZM (XYZM). |
| 4562 |
SRID (spatial reference system identifier) is supported. |
| 4563 |
|
| 4564 |
Use a quoted string containing a WKT/EWKT formatted string or ""PreparedStatement.setObject()"" to store values, |
| 4565 |
and ""ResultSet.getObject(..)"" or ""ResultSet.getString(..)"" to retrieve the values. |
| 4566 |
"," |
| 4567 |
GEOMETRY |
| 4568 |
GEOMETRY(POINT) |
| 4569 |
GEOMETRY(POINT Z) |
| 4570 |
GEOMETRY(POINT Z, 4326) |
| 4571 |
GEOMETRY(GEOMETRY, 4326) |
| 4572 |
" |
| 4573 |
|
| 4574 |
"Data Types","JSON Type"," |
| 4575 |
@h2@ JSON [(lengthInt)] |
| 4576 |
"," |
| 4577 |
A RFC 8259-compliant JSON text. |
| 4578 |
|
| 4579 |
See also [json](https://h2database.com/html/grammar.html#json) literal grammar. |
| 4580 |
Mapped to ""byte[]"". |
| 4581 |
The allowed length is from 1 to 1,000,000,000 bytes. |
| 4582 |
The length is a size constraint; only the actual data is persisted. |
| 4583 |
|
| 4584 |
To set a JSON value with ""java.lang.String"" in a PreparedStatement use a ""FORMAT JSON"" data format |
| 4585 |
(""INSERT INTO TEST(ID, DATA) VALUES (?, ? FORMAT JSON)""). |
| 4586 |
Without the data format VARCHAR values are converted to a JSON string values. |
| 4587 |
|
| 4588 |
Order of object members is preserved as is. |
| 4589 |
Duplicate object member names are allowed. |
| 4590 |
"," |
| 4591 |
JSON |
| 4592 |
" |
| 4593 |
|
| 4594 |
"Data Types","UUID Type"," |
| 4595 |
@h2@ UUID |
| 4596 |
"," |
| 4597 |
Universally unique identifier. This is a 128 bit value. |
| 4598 |
To store values, use ""PreparedStatement.setBytes"", |
| 4599 |
""setString"", or ""setObject(uuid)"" (where ""uuid"" is a ""java.util.UUID""). |
| 4600 |
""ResultSet.getObject"" will return a ""java.util.UUID"". |
| 4601 |
|
| 4602 |
Please note that using an index on randomly generated data will |
| 4603 |
result on poor performance once there are millions of rows in a table. |
| 4604 |
The reason is that the cache behavior is very bad with randomly distributed data. |
| 4605 |
This is a problem for any database system. |
| 4606 |
|
| 4607 |
For details, see the documentation of ""java.util.UUID"". |
| 4608 |
"," |
| 4609 |
UUID |
| 4610 |
" |
| 4611 |
|
| 4612 |
"Data Types","ARRAY Type"," |
| 4613 |
baseDataType ARRAY [ '[' maximumCardinalityInt ']' ] |
| 4614 |
"," |
| 4615 |
A data type for array of values. |
| 4616 |
Base data type specifies the data type of elements. |
| 4617 |
Array may have NULL elements. |
| 4618 |
Maximum cardinality, if any, specifies maximum allowed number of elements in the array. |
| 4619 |
The allowed cardinality is from 0 to 65536 elements. |
| 4620 |
|
| 4621 |
See also [array](https://h2database.com/html/grammar.html#array) literal grammar. |
| 4622 |
Mapped to ""java.lang.Object[]"" (arrays of any non-primitive type are also supported). |
| 4623 |
|
| 4624 |
Use ""PreparedStatement.setArray(..)"" or ""PreparedStatement.setObject(.., new Object[] {..})"" to store values, |
| 4625 |
and ""ResultSet.getObject(..)"" or ""ResultSet.getArray(..)"" to retrieve the values. |
| 4626 |
"," |
| 4627 |
BOOLEAN ARRAY |
| 4628 |
VARCHAR(100) ARRAY |
| 4629 |
INTEGER ARRAY[10] |
| 4630 |
" |
| 4631 |
|
| 4632 |
"Data Types","ROW Type"," |
| 4633 |
ROW (fieldName dataType [,...]) |
| 4634 |
"," |
| 4635 |
A row value data type. This data type should not be normally used as data type of a column. |
| 4636 |
|
| 4637 |
See also [row value expression](https://h2database.com/html/grammar.html#row_value_expression) grammar. |
| 4638 |
Mapped to ""java.sql.ResultSet"". |
| 4639 |
"," |
| 4640 |
ROW(A INT, B VARCHAR(10)) |
| 4641 |
" |
| 4642 |
|
| 4643 |
"Interval Data Types","INTERVAL YEAR Type"," |
| 4644 |
INTERVAL YEAR [ ( precisionInt ) ] |
| 4645 |
"," |
| 4646 |
Interval data type. |
| 4647 |
If precision is specified it should be from 1 to 18, 2 is default. |
| 4648 |
|
| 4649 |
See also [year interval](https://h2database.com/html/grammar.html#interval_year) literal grammar. |
| 4650 |
Mapped to ""org.h2.api.Interval"". |
| 4651 |
""java.time.Period"" is also supported. |
| 4652 |
"," |
| 4653 |
INTERVAL YEAR |
| 4654 |
" |
| 4655 |
|
| 4656 |
"Interval Data Types","INTERVAL MONTH Type"," |
| 4657 |
INTERVAL MONTH [ ( precisionInt ) ] |
| 4658 |
"," |
| 4659 |
Interval data type. |
| 4660 |
If precision is specified it should be from 1 to 18, 2 is default. |
| 4661 |
|
| 4662 |
See also [month interval](https://h2database.com/html/grammar.html#interval_month) literal grammar. |
| 4663 |
Mapped to ""org.h2.api.Interval"". |
| 4664 |
""java.time.Period"" is also supported. |
| 4665 |
"," |
| 4666 |
INTERVAL MONTH |
| 4667 |
" |
| 4668 |
|
| 4669 |
"Interval Data Types","INTERVAL DAY Type"," |
| 4670 |
INTERVAL DAY [ ( precisionInt ) ] |
| 4671 |
"," |
| 4672 |
Interval data type. |
| 4673 |
If precision is specified it should be from 1 to 18, 2 is default. |
| 4674 |
|
| 4675 |
See also [day interval](https://h2database.com/html/grammar.html#interval_day) literal grammar. |
| 4676 |
Mapped to ""org.h2.api.Interval"". |
| 4677 |
""java.time.Duration"" is also supported. |
| 4678 |
"," |
| 4679 |
INTERVAL DAY |
| 4680 |
" |
| 4681 |
|
| 4682 |
"Interval Data Types","INTERVAL HOUR Type"," |
| 4683 |
INTERVAL HOUR [ ( precisionInt ) ] |
| 4684 |
"," |
| 4685 |
Interval data type. |
| 4686 |
If precision is specified it should be from 1 to 18, 2 is default. |
| 4687 |
|
| 4688 |
See also [hour interval](https://h2database.com/html/grammar.html#interval_hour) literal grammar. |
| 4689 |
Mapped to ""org.h2.api.Interval"". |
| 4690 |
""java.time.Duration"" is also supported. |
| 4691 |
"," |
| 4692 |
INTERVAL HOUR |
| 4693 |
" |
| 4694 |
|
| 4695 |
"Interval Data Types","INTERVAL MINUTE Type"," |
| 4696 |
INTERVAL MINUTE [ ( precisionInt ) ] |
| 4697 |
"," |
| 4698 |
Interval data type. |
| 4699 |
If precision is specified it should be from 1 to 18, 2 is default. |
| 4700 |
|
| 4701 |
See also [minute interval](https://h2database.com/html/grammar.html#interval_minute) literal grammar. |
| 4702 |
Mapped to ""org.h2.api.Interval"". |
| 4703 |
""java.time.Duration"" is also supported. |
| 4704 |
"," |
| 4705 |
INTERVAL MINUTE |
| 4706 |
" |
| 4707 |
|
| 4708 |
"Interval Data Types","INTERVAL SECOND Type"," |
| 4709 |
INTERVAL SECOND [ ( precisionInt [, fractionalPrecisionInt ] ) ] |
| 4710 |
"," |
| 4711 |
Interval data type. |
| 4712 |
If precision is specified it should be from 1 to 18, 2 is default. |
| 4713 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 4714 |
|
| 4715 |
See also [second interval](https://h2database.com/html/grammar.html#interval_second) literal grammar. |
| 4716 |
Mapped to ""org.h2.api.Interval"". |
| 4717 |
""java.time.Duration"" is also supported. |
| 4718 |
"," |
| 4719 |
INTERVAL SECOND |
| 4720 |
" |
| 4721 |
|
| 4722 |
"Interval Data Types","INTERVAL YEAR TO MONTH Type"," |
| 4723 |
INTERVAL YEAR [ ( precisionInt ) ] TO MONTH |
| 4724 |
"," |
| 4725 |
Interval data type. |
| 4726 |
If leading field precision is specified it should be from 1 to 18, 2 is default. |
| 4727 |
|
| 4728 |
See also [year to month interval](https://h2database.com/html/grammar.html#interval_year_to_month) literal grammar. |
| 4729 |
Mapped to ""org.h2.api.Interval"". |
| 4730 |
""java.time.Period"" is also supported. |
| 4731 |
"," |
| 4732 |
INTERVAL YEAR TO MONTH |
| 4733 |
" |
| 4734 |
|
| 4735 |
"Interval Data Types","INTERVAL DAY TO HOUR Type"," |
| 4736 |
INTERVAL DAY [ ( precisionInt ) ] TO HOUR |
| 4737 |
"," |
| 4738 |
Interval data type. |
| 4739 |
If leading field precision is specified it should be from 1 to 18, 2 is default. |
| 4740 |
|
| 4741 |
See also [day to hour interval](https://h2database.com/html/grammar.html#interval_day_to_hour) literal grammar. |
| 4742 |
Mapped to ""org.h2.api.Interval"". |
| 4743 |
""java.time.Duration"" is also supported. |
| 4744 |
"," |
| 4745 |
INTERVAL DAY TO HOUR |
| 4746 |
" |
| 4747 |
|
| 4748 |
"Interval Data Types","INTERVAL DAY TO MINUTE Type"," |
| 4749 |
INTERVAL DAY [ ( precisionInt ) ] TO MINUTE |
| 4750 |
"," |
| 4751 |
Interval data type. |
| 4752 |
If leading field precision is specified it should be from 1 to 18, 2 is default. |
| 4753 |
|
| 4754 |
See also [day to minute interval](https://h2database.com/html/grammar.html#interval_day_to_minute) literal grammar. |
| 4755 |
Mapped to ""org.h2.api.Interval"". |
| 4756 |
""java.time.Duration"" is also supported. |
| 4757 |
"," |
| 4758 |
INTERVAL DAY TO MINUTE |
| 4759 |
" |
| 4760 |
|
| 4761 |
"Interval Data Types","INTERVAL DAY TO SECOND Type"," |
| 4762 |
INTERVAL DAY [ ( precisionInt ) ] TO SECOND [ ( fractionalPrecisionInt ) ] |
| 4763 |
"," |
| 4764 |
Interval data type. |
| 4765 |
If leading field precision is specified it should be from 1 to 18, 2 is default. |
| 4766 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 4767 |
|
| 4768 |
See also [day to second interval](https://h2database.com/html/grammar.html#interval_day_to_second) literal grammar. |
| 4769 |
Mapped to ""org.h2.api.Interval"". |
| 4770 |
""java.time.Duration"" is also supported. |
| 4771 |
"," |
| 4772 |
INTERVAL DAY TO SECOND |
| 4773 |
" |
| 4774 |
|
| 4775 |
"Interval Data Types","INTERVAL HOUR TO MINUTE Type"," |
| 4776 |
INTERVAL HOUR [ ( precisionInt ) ] TO MINUTE |
| 4777 |
"," |
| 4778 |
Interval data type. |
| 4779 |
If leading field precision is specified it should be from 1 to 18, 2 is default. |
| 4780 |
|
| 4781 |
See also [hour to minute interval](https://h2database.com/html/grammar.html#interval_hour_to_minute) literal grammar. |
| 4782 |
Mapped to ""org.h2.api.Interval"". |
| 4783 |
""java.time.Duration"" is also supported. |
| 4784 |
"," |
| 4785 |
INTERVAL HOUR TO MINUTE |
| 4786 |
" |
| 4787 |
|
| 4788 |
"Interval Data Types","INTERVAL HOUR TO SECOND Type"," |
| 4789 |
INTERVAL HOUR [ ( precisionInt ) ] TO SECOND [ ( fractionalPrecisionInt ) ] |
| 4790 |
"," |
| 4791 |
Interval data type. |
| 4792 |
If leading field precision is specified it should be from 1 to 18, 2 is default. |
| 4793 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 4794 |
|
| 4795 |
See also [hour to second interval](https://h2database.com/html/grammar.html#interval_hour_to_second) literal grammar. |
| 4796 |
Mapped to ""org.h2.api.Interval"". |
| 4797 |
""java.time.Duration"" is also supported. |
| 4798 |
"," |
| 4799 |
INTERVAL HOUR TO SECOND |
| 4800 |
" |
| 4801 |
|
| 4802 |
"Interval Data Types","INTERVAL MINUTE TO SECOND Type"," |
| 4803 |
INTERVAL MINUTE [ ( precisionInt ) ] TO SECOND [ ( fractionalPrecisionInt ) ] |
| 4804 |
"," |
| 4805 |
Interval data type. |
| 4806 |
If leading field precision is specified it should be from 1 to 18, 2 is default. |
| 4807 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 4808 |
|
| 4809 |
See also [minute to second interval](https://h2database.com/html/grammar.html#interval_minute_to_second) literal grammar. |
| 4810 |
Mapped to ""org.h2.api.Interval"". |
| 4811 |
""java.time.Duration"" is also supported. |
| 4812 |
"," |
| 4813 |
INTERVAL MINUTE TO SECOND |
| 4814 |
" |
| 4815 |
|
| 4816 |
"Functions (Numeric)","ABS"," |
| 4817 |
ABS( { numeric | interval } ) |
| 4818 |
"," |
| 4819 |
Returns the absolute value of a specified value. |
| 4820 |
The returned value is of the same data type as the parameter. |
| 4821 |
|
| 4822 |
Note that TINYINT, SMALLINT, INT, and BIGINT data types cannot represent absolute values |
| 4823 |
of their minimum negative values, because they have more negative values than positive. |
| 4824 |
For example, for INT data type allowed values are from -2147483648 to 2147483647. |
| 4825 |
ABS(-2147483648) should be 2147483648, but this value is not allowed for this data type. |
| 4826 |
It leads to an exception. |
| 4827 |
To avoid it cast argument of this function to a higher data type. |
| 4828 |
"," |
| 4829 |
ABS(I) |
| 4830 |
ABS(CAST(I AS BIGINT)) |
| 4831 |
" |
| 4832 |
|
| 4833 |
"Functions (Numeric)","ACOS"," |
| 4834 |
ACOS(numeric) |
| 4835 |
"," |
| 4836 |
Calculate the arc cosine. |
| 4837 |
See also Java ""Math.acos"". |
| 4838 |
This method returns a double. |
| 4839 |
"," |
| 4840 |
ACOS(D) |
| 4841 |
" |
| 4842 |
|
| 4843 |
"Functions (Numeric)","ASIN"," |
| 4844 |
ASIN(numeric) |
| 4845 |
"," |
| 4846 |
Calculate the arc sine. |
| 4847 |
See also Java ""Math.asin"". |
| 4848 |
This method returns a double. |
| 4849 |
"," |
| 4850 |
ASIN(D) |
| 4851 |
" |
| 4852 |
|
| 4853 |
"Functions (Numeric)","ATAN"," |
| 4854 |
ATAN(numeric) |
| 4855 |
"," |
| 4856 |
Calculate the arc tangent. |
| 4857 |
See also Java ""Math.atan"". |
| 4858 |
This method returns a double. |
| 4859 |
"," |
| 4860 |
ATAN(D) |
| 4861 |
" |
| 4862 |
|
| 4863 |
"Functions (Numeric)","COS"," |
| 4864 |
COS(numeric) |
| 4865 |
"," |
| 4866 |
Calculate the trigonometric cosine. |
| 4867 |
See also Java ""Math.cos"". |
| 4868 |
This method returns a double. |
| 4869 |
"," |
| 4870 |
COS(ANGLE) |
| 4871 |
" |
| 4872 |
|
| 4873 |
"Functions (Numeric)","COSH"," |
| 4874 |
COSH(numeric) |
| 4875 |
"," |
| 4876 |
Calculate the hyperbolic cosine. |
| 4877 |
See also Java ""Math.cosh"". |
| 4878 |
This method returns a double. |
| 4879 |
"," |
| 4880 |
COSH(X) |
| 4881 |
" |
| 4882 |
|
| 4883 |
"Functions (Numeric)","COT"," |
| 4884 |
@h2@ COT(numeric) |
| 4885 |
"," |
| 4886 |
Calculate the trigonometric cotangent (""1/TAN(ANGLE)""). |
| 4887 |
See also Java ""Math.*"" functions. |
| 4888 |
This method returns a double. |
| 4889 |
"," |
| 4890 |
COT(ANGLE) |
| 4891 |
" |
| 4892 |
|
| 4893 |
"Functions (Numeric)","SIN"," |
| 4894 |
SIN(numeric) |
| 4895 |
"," |
| 4896 |
Calculate the trigonometric sine. |
| 4897 |
See also Java ""Math.sin"". |
| 4898 |
This method returns a double. |
| 4899 |
"," |
| 4900 |
SIN(ANGLE) |
| 4901 |
" |
| 4902 |
|
| 4903 |
"Functions (Numeric)","SINH"," |
| 4904 |
SINH(numeric) |
| 4905 |
"," |
| 4906 |
Calculate the hyperbolic sine. |
| 4907 |
See also Java ""Math.sinh"". |
| 4908 |
This method returns a double. |
| 4909 |
"," |
| 4910 |
SINH(ANGLE) |
| 4911 |
" |
| 4912 |
|
| 4913 |
"Functions (Numeric)","TAN"," |
| 4914 |
TAN(numeric) |
| 4915 |
"," |
| 4916 |
Calculate the trigonometric tangent. |
| 4917 |
See also Java ""Math.tan"". |
| 4918 |
This method returns a double. |
| 4919 |
"," |
| 4920 |
TAN(ANGLE) |
| 4921 |
" |
| 4922 |
|
| 4923 |
"Functions (Numeric)","TANH"," |
| 4924 |
TANH(numeric) |
| 4925 |
"," |
| 4926 |
Calculate the hyperbolic tangent. |
| 4927 |
See also Java ""Math.tanh"". |
| 4928 |
This method returns a double. |
| 4929 |
"," |
| 4930 |
TANH(X) |
| 4931 |
" |
| 4932 |
|
| 4933 |
"Functions (Numeric)","ATAN2"," |
| 4934 |
@h2@ ATAN2(numeric, numeric) |
| 4935 |
"," |
| 4936 |
Calculate the angle when converting the rectangular coordinates to polar coordinates. |
| 4937 |
See also Java ""Math.atan2"". |
| 4938 |
This method returns a double. |
| 4939 |
"," |
| 4940 |
ATAN2(X, Y) |
| 4941 |
" |
| 4942 |
|
| 4943 |
"Functions (Numeric)","BITAND"," |
| 4944 |
@h2@ BITAND(expression, expression) |
| 4945 |
"," |
| 4946 |
The bitwise AND operation. |
| 4947 |
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 4948 |
This function returns result of the same data type. |
| 4949 |
|
| 4950 |
For aggregate function see [BIT_AND_AGG](https://h2database.com/html/functions-aggregate.html#bit_and_agg). |
| 4951 |
"," |
| 4952 |
BITAND(A, B) |
| 4953 |
" |
| 4954 |
|
| 4955 |
"Functions (Numeric)","BITOR"," |
| 4956 |
@h2@ BITOR(expression, expression) |
| 4957 |
"," |
| 4958 |
The bitwise OR operation. |
| 4959 |
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 4960 |
This function returns result of the same data type. |
| 4961 |
|
| 4962 |
For aggregate function see [BIT_OR_AGG](https://h2database.com/html/functions-aggregate.html#bit_or_agg). |
| 4963 |
"," |
| 4964 |
BITOR(A, B) |
| 4965 |
" |
| 4966 |
|
| 4967 |
"Functions (Numeric)","BITXOR"," |
| 4968 |
@h2@ BITXOR(expression, expression) |
| 4969 |
"," |
| 4970 |
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 4971 |
This function returns result of the same data type. |
| 4972 |
|
| 4973 |
For aggregate function see [BIT_XOR_AGG](https://h2database.com/html/functions-aggregate.html#bit_xor_agg). |
| 4974 |
"," |
| 4975 |
The bitwise XOR operation. |
| 4976 |
"," |
| 4977 |
BITXOR(A, B) |
| 4978 |
" |
| 4979 |
|
| 4980 |
"Functions (Numeric)","BITNOT"," |
| 4981 |
@h2@ BITNOT(expression) |
| 4982 |
"," |
| 4983 |
The bitwise NOT operation. |
| 4984 |
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 4985 |
This function returns result of the same data type. |
| 4986 |
"," |
| 4987 |
BITNOT(A) |
| 4988 |
" |
| 4989 |
|
| 4990 |
"Functions (Numeric)","BITNAND"," |
| 4991 |
@h2@ BITNAND(expression, expression) |
| 4992 |
"," |
| 4993 |
The bitwise NAND operation equivalent to ""BITNOT(BITAND(expression, expression))"". |
| 4994 |
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 4995 |
This function returns result of the same data type. |
| 4996 |
|
| 4997 |
For aggregate function see [BIT_NAND_AGG](https://h2database.com/html/functions-aggregate.html#bit_nand_agg). |
| 4998 |
"," |
| 4999 |
BITNAND(A, B) |
| 5000 |
" |
| 5001 |
|
| 5002 |
"Functions (Numeric)","BITNOR"," |
| 5003 |
@h2@ BITNOR(expression, expression) |
| 5004 |
"," |
| 5005 |
The bitwise NOR operation equivalent to ""BITNOT(BITOR(expression, expression))"". |
| 5006 |
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5007 |
This function returns result of the same data type. |
| 5008 |
|
| 5009 |
For aggregate function see [BIT_NOR_AGG](https://h2database.com/html/functions-aggregate.html#bit_nor_agg). |
| 5010 |
"," |
| 5011 |
BITNOR(A, B) |
| 5012 |
" |
| 5013 |
|
| 5014 |
"Functions (Numeric)","BITXNOR"," |
| 5015 |
@h2@ BITXNOR(expression, expression) |
| 5016 |
"," |
| 5017 |
The bitwise XNOR operation equivalent to ""BITNOT(BITXOR(expression, expression))"". |
| 5018 |
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5019 |
This function returns result of the same data type. |
| 5020 |
|
| 5021 |
For aggregate function see [BIT_XNOR_AGG](https://h2database.com/html/functions-aggregate.html#bit_xnor_agg). |
| 5022 |
"," |
| 5023 |
BITXNOR(A, B) |
| 5024 |
" |
| 5025 |
|
| 5026 |
"Functions (Numeric)","BITGET"," |
| 5027 |
@h2@ BITGET(expression, long) |
| 5028 |
"," |
| 5029 |
Returns true if and only if the first argument has a bit set in the |
| 5030 |
position specified by the second parameter. |
| 5031 |
The first argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5032 |
This method returns a boolean. |
| 5033 |
The second argument is zero-indexed; the least significant bit has position 0. |
| 5034 |
"," |
| 5035 |
BITGET(A, 1) |
| 5036 |
" |
| 5037 |
|
| 5038 |
"Functions (Numeric)","BITCOUNT"," |
| 5039 |
@h2@ BITCOUNT(expression) |
| 5040 |
"," |
| 5041 |
Returns count of set bits in the specified value. |
| 5042 |
Value should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5043 |
This method returns a long. |
| 5044 |
"," |
| 5045 |
BITCOUNT(A) |
| 5046 |
" |
| 5047 |
|
| 5048 |
"Functions (Numeric)","LSHIFT"," |
| 5049 |
@h2@ LSHIFT(expression, long) |
| 5050 |
"," |
| 5051 |
The bitwise signed left shift operation. |
| 5052 |
Shifts the first argument by the number of bits given by the second argument. |
| 5053 |
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5054 |
This function returns result of the same data type. |
| 5055 |
|
| 5056 |
If number of bits is negative, a signed right shift is performed instead. |
| 5057 |
For numeric values a sign bit is used for left-padding (with negative offset). |
| 5058 |
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value. |
| 5059 |
For binary string arguments signed and unsigned shifts return the same results. |
| 5060 |
"," |
| 5061 |
LSHIFT(A, B) |
| 5062 |
" |
| 5063 |
|
| 5064 |
"Functions (Numeric)","RSHIFT"," |
| 5065 |
@h2@ RSHIFT(expression, long) |
| 5066 |
"," |
| 5067 |
The bitwise signed right shift operation. |
| 5068 |
Shifts the first argument by the number of bits given by the second argument. |
| 5069 |
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5070 |
This function returns result of the same data type. |
| 5071 |
|
| 5072 |
If number of bits is negative, a signed left shift is performed instead. |
| 5073 |
For numeric values a sign bit is used for left-padding (with positive offset). |
| 5074 |
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value. |
| 5075 |
For binary string arguments signed and unsigned shifts return the same results. |
| 5076 |
"," |
| 5077 |
RSHIFT(A, B) |
| 5078 |
" |
| 5079 |
|
| 5080 |
"Functions (Numeric)","ULSHIFT"," |
| 5081 |
@h2@ ULSHIFT(expression, long) |
| 5082 |
"," |
| 5083 |
The bitwise unsigned left shift operation. |
| 5084 |
Shifts the first argument by the number of bits given by the second argument. |
| 5085 |
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5086 |
This function returns result of the same data type. |
| 5087 |
|
| 5088 |
If number of bits is negative, an unsigned right shift is performed instead. |
| 5089 |
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value. |
| 5090 |
For binary string arguments signed and unsigned shifts return the same results. |
| 5091 |
"," |
| 5092 |
ULSHIFT(A, B) |
| 5093 |
" |
| 5094 |
|
| 5095 |
"Functions (Numeric)","URSHIFT"," |
| 5096 |
@h2@ URSHIFT(expression, long) |
| 5097 |
"," |
| 5098 |
The bitwise unsigned right shift operation. |
| 5099 |
Shifts the first argument by the number of bits given by the second argument. |
| 5100 |
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5101 |
This function returns result of the same data type. |
| 5102 |
|
| 5103 |
If number of bits is negative, an unsigned left shift is performed instead. |
| 5104 |
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value. |
| 5105 |
For binary string arguments signed and unsigned shifts return the same results. |
| 5106 |
"," |
| 5107 |
URSHIFT(A, B) |
| 5108 |
" |
| 5109 |
|
| 5110 |
"Functions (Numeric)","ROTATELEFT"," |
| 5111 |
@h2@ ROTATELEFT(expression, long) |
| 5112 |
"," |
| 5113 |
The bitwise left rotation operation. |
| 5114 |
Rotates the first argument by the number of bits given by the second argument. |
| 5115 |
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5116 |
This function returns result of the same data type. |
| 5117 |
"," |
| 5118 |
ROTATELEFT(A, B) |
| 5119 |
" |
| 5120 |
|
| 5121 |
"Functions (Numeric)","ROTATERIGHT"," |
| 5122 |
@h2@ ROTATERIGHT(expression, long) |
| 5123 |
"," |
| 5124 |
The bitwise right rotation operation. |
| 5125 |
Rotates the first argument by the number of bits given by the second argument. |
| 5126 |
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type. |
| 5127 |
This function returns result of the same data type. |
| 5128 |
"," |
| 5129 |
ROTATERIGHT(A, B) |
| 5130 |
" |
| 5131 |
|
| 5132 |
"Functions (Numeric)","MOD"," |
| 5133 |
MOD(dividendNumeric, divisorNumeric) |
| 5134 |
"," |
| 5135 |
The modulus expression. |
| 5136 |
|
| 5137 |
Result has the same type as divisor. |
| 5138 |
Result is NULL if either of arguments is NULL. |
| 5139 |
If divisor is 0, an exception is raised. |
| 5140 |
Result has the same sign as dividend or is equal to 0. |
| 5141 |
|
| 5142 |
Usually arguments should have scale 0, but it isn't required by H2. |
| 5143 |
"," |
| 5144 |
MOD(A, B) |
| 5145 |
" |
| 5146 |
|
| 5147 |
"Functions (Numeric)","CEIL"," |
| 5148 |
{ CEIL | CEILING } (numeric) |
| 5149 |
"," |
| 5150 |
Returns the smallest integer value that is greater than or equal to the argument. |
| 5151 |
This method returns value of the same type as argument, but with scale set to 0 and adjusted precision, if applicable. |
| 5152 |
"," |
| 5153 |
CEIL(A) |
| 5154 |
" |
| 5155 |
|
| 5156 |
"Functions (Numeric)","DEGREES"," |
| 5157 |
@h2@ DEGREES(numeric) |
| 5158 |
"," |
| 5159 |
See also Java ""Math.toDegrees"". |
| 5160 |
This method returns a double. |
| 5161 |
"," |
| 5162 |
DEGREES(A) |
| 5163 |
" |
| 5164 |
|
| 5165 |
"Functions (Numeric)","EXP"," |
| 5166 |
EXP(numeric) |
| 5167 |
"," |
| 5168 |
See also Java ""Math.exp"". |
| 5169 |
This method returns a double. |
| 5170 |
"," |
| 5171 |
EXP(A) |
| 5172 |
" |
| 5173 |
|
| 5174 |
"Functions (Numeric)","FLOOR"," |
| 5175 |
FLOOR(numeric) |
| 5176 |
"," |
| 5177 |
Returns the largest integer value that is less than or equal to the argument. |
| 5178 |
This method returns value of the same type as argument, but with scale set to 0 and adjusted precision, if applicable. |
| 5179 |
"," |
| 5180 |
FLOOR(A) |
| 5181 |
" |
| 5182 |
|
| 5183 |
"Functions (Numeric)","LN"," |
| 5184 |
LN(numeric) |
| 5185 |
"," |
| 5186 |
Calculates the natural (base e) logarithm as a double value. |
| 5187 |
Argument must be a positive numeric value. |
| 5188 |
"," |
| 5189 |
LN(A) |
| 5190 |
" |
| 5191 |
|
| 5192 |
"Functions (Numeric)","LOG"," |
| 5193 |
LOG({baseNumeric, numeric | @c@{numeric}}) |
| 5194 |
"," |
| 5195 |
Calculates the logarithm with specified base as a double value. |
| 5196 |
Argument and base must be positive numeric values. |
| 5197 |
Base cannot be equal to 1. |
| 5198 |
|
| 5199 |
The default base is e (natural logarithm), in the PostgreSQL mode the default base is base 10. |
| 5200 |
In MSSQLServer mode the optional base is specified after the argument. |
| 5201 |
|
| 5202 |
Single-argument variant of LOG function is deprecated, use [LN](https://h2database.com/html/functions.html#ln) |
| 5203 |
or [LOG10](https://h2database.com/html/functions.html#log10) instead. |
| 5204 |
"," |
| 5205 |
LOG(2, A) |
| 5206 |
" |
| 5207 |
|
| 5208 |
"Functions (Numeric)","LOG10"," |
| 5209 |
LOG10(numeric) |
| 5210 |
"," |
| 5211 |
Calculates the base 10 logarithm as a double value. |
| 5212 |
Argument must be a positive numeric value. |
| 5213 |
"," |
| 5214 |
LOG10(A) |
| 5215 |
" |
| 5216 |
|
| 5217 |
"Functions (Numeric)","ORA_HASH"," |
| 5218 |
@c@ ORA_HASH(expression [, bucketLong [, seedLong]]) |
| 5219 |
"," |
| 5220 |
Computes a hash value. |
| 5221 |
Optional bucket argument determines the maximum returned value. |
| 5222 |
This argument should be between 0 and 4294967295, default is 4294967295. |
| 5223 |
Optional seed argument is combined with the given expression to return the different values for the same expression. |
| 5224 |
This argument should be between 0 and 4294967295, default is 0. |
| 5225 |
This method returns a long value between 0 and the specified or default bucket value inclusive. |
| 5226 |
"," |
| 5227 |
ORA_HASH(A) |
| 5228 |
" |
| 5229 |
|
| 5230 |
"Functions (Numeric)","RADIANS"," |
| 5231 |
@h2@ RADIANS(numeric) |
| 5232 |
"," |
| 5233 |
See also Java ""Math.toRadians"". |
| 5234 |
This method returns a double. |
| 5235 |
"," |
| 5236 |
RADIANS(A) |
| 5237 |
" |
| 5238 |
|
| 5239 |
"Functions (Numeric)","SQRT"," |
| 5240 |
SQRT(numeric) |
| 5241 |
"," |
| 5242 |
See also Java ""Math.sqrt"". |
| 5243 |
This method returns a double. |
| 5244 |
"," |
| 5245 |
SQRT(A) |
| 5246 |
" |
| 5247 |
|
| 5248 |
"Functions (Numeric)","PI"," |
| 5249 |
@h2@ PI() |
| 5250 |
"," |
| 5251 |
See also Java ""Math.PI"". |
| 5252 |
This method returns a double. |
| 5253 |
"," |
| 5254 |
PI() |
| 5255 |
" |
| 5256 |
|
| 5257 |
"Functions (Numeric)","POWER"," |
| 5258 |
POWER(numeric, numeric) |
| 5259 |
"," |
| 5260 |
See also Java ""Math.pow"". |
| 5261 |
This method returns a double. |
| 5262 |
"," |
| 5263 |
POWER(A, B) |
| 5264 |
" |
| 5265 |
|
| 5266 |
"Functions (Numeric)","RAND"," |
| 5267 |
@h2@ { RAND | RANDOM } ( [ int ] ) |
| 5268 |
"," |
| 5269 |
Calling the function without parameter returns the next a pseudo random number. |
| 5270 |
Calling it with an parameter seeds the session's random number generator. |
| 5271 |
This method returns a double between 0 (including) and 1 (excluding). |
| 5272 |
"," |
| 5273 |
RAND() |
| 5274 |
" |
| 5275 |
|
| 5276 |
"Functions (Numeric)","RANDOM_UUID"," |
| 5277 |
@h2@ { RANDOM_UUID | UUID } () |
| 5278 |
"," |
| 5279 |
Returns a new UUID with 122 pseudo random bits. |
| 5280 |
|
| 5281 |
Please note that using an index on randomly generated data will |
| 5282 |
result on poor performance once there are millions of rows in a table. |
| 5283 |
The reason is that the cache behavior is very bad with randomly distributed data. |
| 5284 |
This is a problem for any database system. |
| 5285 |
"," |
| 5286 |
RANDOM_UUID() |
| 5287 |
" |
| 5288 |
|
| 5289 |
"Functions (Numeric)","ROUND"," |
| 5290 |
@h2@ ROUND(numeric [, digitsInt]) |
| 5291 |
"," |
| 5292 |
Rounds to a number of fractional digits. |
| 5293 |
This method returns value of the same type as argument, but with adjusted precision and scale, if applicable. |
| 5294 |
"," |
| 5295 |
ROUND(N, 2) |
| 5296 |
" |
| 5297 |
|
| 5298 |
"Functions (Numeric)","SECURE_RAND"," |
| 5299 |
@h2@ SECURE_RAND(int) |
| 5300 |
"," |
| 5301 |
Generates a number of cryptographically secure random numbers. |
| 5302 |
This method returns bytes. |
| 5303 |
"," |
| 5304 |
CALL SECURE_RAND(16) |
| 5305 |
" |
| 5306 |
|
| 5307 |
"Functions (Numeric)","SIGN"," |
| 5308 |
@h2@ SIGN( { numeric | interval } ) |
| 5309 |
"," |
| 5310 |
Returns -1 if the value is smaller than 0, 0 if zero or NaN, and otherwise 1. |
| 5311 |
"," |
| 5312 |
SIGN(N) |
| 5313 |
" |
| 5314 |
|
| 5315 |
"Functions (Numeric)","ENCRYPT"," |
| 5316 |
@h2@ ENCRYPT(algorithmString, keyBytes, dataBytes) |
| 5317 |
"," |
| 5318 |
Encrypts data using a key. |
| 5319 |
The supported algorithm is AES. |
| 5320 |
The block size is 16 bytes. |
| 5321 |
This method returns bytes. |
| 5322 |
"," |
| 5323 |
CALL ENCRYPT('AES', '00', STRINGTOUTF8('Test')) |
| 5324 |
" |
| 5325 |
|
| 5326 |
"Functions (Numeric)","DECRYPT"," |
| 5327 |
@h2@ DECRYPT(algorithmString, keyBytes, dataBytes) |
| 5328 |
"," |
| 5329 |
Decrypts data using a key. |
| 5330 |
The supported algorithm is AES. |
| 5331 |
The block size is 16 bytes. |
| 5332 |
This method returns bytes. |
| 5333 |
"," |
| 5334 |
CALL TRIM(CHAR(0) FROM UTF8TOSTRING( |
| 5335 |
DECRYPT('AES', '00', '3fabb4de8f1ee2e97d7793bab2db1116'))) |
| 5336 |
" |
| 5337 |
|
| 5338 |
"Functions (Numeric)","HASH"," |
| 5339 |
@h2@ HASH(algorithmString, expression [, iterationInt]) |
| 5340 |
"," |
| 5341 |
Calculate the hash value using an algorithm, and repeat this process for a number of iterations. |
| 5342 |
|
| 5343 |
This function supports MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, SHA3-256, SHA3-384, and SHA3-512 |
| 5344 |
algorithms. |
| 5345 |
SHA-224, SHA-384, and SHA-512 may be unavailable in some JREs. |
| 5346 |
|
| 5347 |
MD5 and SHA-1 algorithms should not be considered as secure. |
| 5348 |
|
| 5349 |
If this function is used to encrypt a password, a random salt should be concatenated with a password and this salt and |
| 5350 |
result of the function should be stored to prevent a rainbow table attack and number of iterations should be large |
| 5351 |
enough to slow down a dictionary or a brute force attack. |
| 5352 |
|
| 5353 |
This method returns bytes. |
| 5354 |
"," |
| 5355 |
CALL HASH('SHA-256', 'Text', 1000) |
| 5356 |
CALL HASH('SHA3-256', X'0102') |
| 5357 |
" |
| 5358 |
|
| 5359 |
"Functions (Numeric)","TRUNC"," |
| 5360 |
@h2@ { TRUNC | TRUNCATE } ( { {numeric [, digitsInt] } |
| 5361 |
| @c@ { timestamp | timestampWithTimeZone | date | timestampString } } ) |
| 5362 |
"," |
| 5363 |
When a numeric argument is specified, truncates it to a number of digits (to the next value closer to 0) |
| 5364 |
and returns value of the same type as argument, but with adjusted precision and scale, if applicable. |
| 5365 |
|
| 5366 |
This function with datetime or string argument is deprecated, use |
| 5367 |
[DATE_TRUNC](https://h2database.com/html/functions.html#date_trunc) instead. |
| 5368 |
When used with a timestamp, truncates the timestamp to a date (day) value |
| 5369 |
and returns a timestamp with or without time zone depending on type of the argument. |
| 5370 |
When used with a date, returns a timestamp at start of this date. |
| 5371 |
When used with a timestamp as string, truncates the timestamp to a date (day) value |
| 5372 |
and returns a timestamp without time zone. |
| 5373 |
"," |
| 5374 |
TRUNCATE(N, 2) |
| 5375 |
" |
| 5376 |
|
| 5377 |
"Functions (Numeric)","COMPRESS"," |
| 5378 |
@h2@ COMPRESS(dataBytes [, algorithmString]) |
| 5379 |
"," |
| 5380 |
Compresses the data using the specified compression algorithm. |
| 5381 |
Supported algorithms are: LZF (faster but lower compression; default), and DEFLATE (higher compression). |
| 5382 |
Compression does not always reduce size. Very small objects and objects with little redundancy may get larger. |
| 5383 |
This method returns bytes. |
| 5384 |
"," |
| 5385 |
COMPRESS(STRINGTOUTF8('Test')) |
| 5386 |
" |
| 5387 |
|
| 5388 |
"Functions (Numeric)","EXPAND"," |
| 5389 |
@h2@ EXPAND(bytes) |
| 5390 |
"," |
| 5391 |
Expands data that was compressed using the COMPRESS function. |
| 5392 |
This method returns bytes. |
| 5393 |
"," |
| 5394 |
UTF8TOSTRING(EXPAND(COMPRESS(STRINGTOUTF8('Test')))) |
| 5395 |
" |
| 5396 |
|
| 5397 |
"Functions (Numeric)","ZERO"," |
| 5398 |
@h2@ ZERO() |
| 5399 |
"," |
| 5400 |
Returns the value 0. This function can be used even if numeric literals are disabled. |
| 5401 |
"," |
| 5402 |
ZERO() |
| 5403 |
" |
| 5404 |
|
| 5405 |
"Functions (String)","ASCII"," |
| 5406 |
@h2@ ASCII(string) |
| 5407 |
"," |
| 5408 |
Returns the ASCII value of the first character in the string. |
| 5409 |
This method returns an int. |
| 5410 |
"," |
| 5411 |
ASCII('Hi') |
| 5412 |
" |
| 5413 |
"Functions (String)","BIT_LENGTH"," |
| 5414 |
@h2@ BIT_LENGTH(bytes) |
| 5415 |
"," |
| 5416 |
Returns the number of bits in a binary string. |
| 5417 |
This method returns a long. |
| 5418 |
"," |
| 5419 |
BIT_LENGTH(NAME) |
| 5420 |
" |
| 5421 |
|
| 5422 |
"Functions (String)","CHAR_LENGTH"," |
| 5423 |
{ CHAR_LENGTH | CHARACTER_LENGTH | @c@ { LENGTH } } ( string ) |
| 5424 |
"," |
| 5425 |
Returns the number of characters in a character string. |
| 5426 |
This method returns a long. |
| 5427 |
"," |
| 5428 |
CHAR_LENGTH(NAME) |
| 5429 |
" |
| 5430 |
|
| 5431 |
"Functions (String)","OCTET_LENGTH"," |
| 5432 |
OCTET_LENGTH(bytes) |
| 5433 |
"," |
| 5434 |
Returns the number of bytes in a binary string. |
| 5435 |
This method returns a long. |
| 5436 |
"," |
| 5437 |
OCTET_LENGTH(NAME) |
| 5438 |
" |
| 5439 |
|
| 5440 |
"Functions (String)","CHAR"," |
| 5441 |
@h2@ { CHAR | CHR } ( int ) |
| 5442 |
"," |
| 5443 |
Returns the character that represents the ASCII value. |
| 5444 |
This method returns a string. |
| 5445 |
"," |
| 5446 |
CHAR(65) |
| 5447 |
" |
| 5448 |
|
| 5449 |
"Functions (String)","CONCAT"," |
| 5450 |
@h2@ CONCAT(string, string [,...]) |
| 5451 |
"," |
| 5452 |
Combines strings. |
| 5453 |
Unlike with the operator ""||"", NULL parameters are ignored, |
| 5454 |
and do not cause the result to become NULL. |
| 5455 |
If all parameters are NULL the result is an empty string. |
| 5456 |
This method returns a string. |
| 5457 |
"," |
| 5458 |
CONCAT(NAME, '!') |
| 5459 |
" |
| 5460 |
|
| 5461 |
"Functions (String)","CONCAT_WS"," |
| 5462 |
@h2@ CONCAT_WS(separatorString, string, string [,...]) |
| 5463 |
"," |
| 5464 |
Combines strings with separator. |
| 5465 |
If separator is NULL it is treated like an empty string. |
| 5466 |
Other NULL parameters are ignored. |
| 5467 |
Remaining non-NULL parameters, if any, are concatenated with the specified separator. |
| 5468 |
If there are no remaining parameters the result is an empty string. |
| 5469 |
This method returns a string. |
| 5470 |
"," |
| 5471 |
CONCAT_WS(',', NAME, '!') |
| 5472 |
" |
| 5473 |
|
| 5474 |
"Functions (String)","DIFFERENCE"," |
| 5475 |
@h2@ DIFFERENCE(string, string) |
| 5476 |
"," |
| 5477 |
Returns the difference between the sounds of two strings. |
| 5478 |
The difference is calculated as a number of matched characters |
| 5479 |
in the same positions in SOUNDEX representations of arguments. |
| 5480 |
This method returns an int between 0 and 4 inclusive, or null if any of its parameters is null. |
| 5481 |
Note that value of 0 means that strings are not similar to each other. |
| 5482 |
Value of 4 means that strings are fully similar to each other (have the same SOUNDEX representation). |
| 5483 |
"," |
| 5484 |
DIFFERENCE(T1.NAME, T2.NAME) |
| 5485 |
" |
| 5486 |
|
| 5487 |
"Functions (String)","HEXTORAW"," |
| 5488 |
@h2@ HEXTORAW(string) |
| 5489 |
"," |
| 5490 |
Converts a hex representation of a string to a string. |
| 5491 |
4 hex characters per string character are used. |
| 5492 |
"," |
| 5493 |
HEXTORAW(DATA) |
| 5494 |
" |
| 5495 |
|
| 5496 |
"Functions (String)","RAWTOHEX"," |
| 5497 |
@h2@ RAWTOHEX({string|bytes}) |
| 5498 |
"," |
| 5499 |
Converts a string or bytes to the hex representation. |
| 5500 |
4 hex characters per string character are used. |
| 5501 |
This method returns a string. |
| 5502 |
"," |
| 5503 |
RAWTOHEX(DATA) |
| 5504 |
" |
| 5505 |
|
| 5506 |
"Functions (String)","INSERT Function"," |
| 5507 |
@h2@ INSERT(originalString, startInt, lengthInt, addString) |
| 5508 |
"," |
| 5509 |
Inserts a additional string into the original string at a specified start position. |
| 5510 |
The length specifies the number of characters that are removed at the start position in the original string. |
| 5511 |
This method returns a string. |
| 5512 |
"," |
| 5513 |
INSERT(NAME, 1, 1, ' ') |
| 5514 |
" |
| 5515 |
|
| 5516 |
"Functions (String)","LOWER"," |
| 5517 |
{ LOWER | @c@ { LCASE } } ( string ) |
| 5518 |
"," |
| 5519 |
Converts a string to lowercase. |
| 5520 |
"," |
| 5521 |
LOWER(NAME) |
| 5522 |
" |
| 5523 |
|
| 5524 |
"Functions (String)","UPPER"," |
| 5525 |
{ UPPER | @c@ { UCASE } } ( string ) |
| 5526 |
"," |
| 5527 |
Converts a string to uppercase. |
| 5528 |
"," |
| 5529 |
UPPER(NAME) |
| 5530 |
" |
| 5531 |
|
| 5532 |
"Functions (String)","LEFT"," |
| 5533 |
@h2@ LEFT(string, int) |
| 5534 |
"," |
| 5535 |
Returns the leftmost number of characters. |
| 5536 |
"," |
| 5537 |
LEFT(NAME, 3) |
| 5538 |
" |
| 5539 |
|
| 5540 |
"Functions (String)","RIGHT"," |
| 5541 |
@h2@ RIGHT(string, int) |
| 5542 |
"," |
| 5543 |
Returns the rightmost number of characters. |
| 5544 |
"," |
| 5545 |
RIGHT(NAME, 3) |
| 5546 |
" |
| 5547 |
|
| 5548 |
"Functions (String)","LOCATE"," |
| 5549 |
@h2@ { LOCATE(searchString, string [, startInt]) } |
| 5550 |
| @c@ { INSTR(string, searchString, [, startInt]) } |
| 5551 |
| @c@ { POSITION(searchString, string) } |
| 5552 |
"," |
| 5553 |
Returns the location of a search string in a string. |
| 5554 |
If a start position is used, the characters before it are ignored. |
| 5555 |
If position is negative, the rightmost location is returned. |
| 5556 |
0 is returned if the search string is not found. |
| 5557 |
Please note this function is case sensitive, even if the parameters are not. |
| 5558 |
"," |
| 5559 |
LOCATE('.', NAME) |
| 5560 |
" |
| 5561 |
|
| 5562 |
"Functions (String)","LPAD"," |
| 5563 |
LPAD(string, int[, paddingString]) |
| 5564 |
"," |
| 5565 |
Left pad the string to the specified length. |
| 5566 |
If the length is shorter than the string, it will be truncated at the end. |
| 5567 |
If the padding string is not set, spaces will be used. |
| 5568 |
"," |
| 5569 |
LPAD(AMOUNT, 10, '*') |
| 5570 |
" |
| 5571 |
|
| 5572 |
"Functions (String)","RPAD"," |
| 5573 |
RPAD(string, int[, paddingString]) |
| 5574 |
"," |
| 5575 |
Right pad the string to the specified length. |
| 5576 |
If the length is shorter than the string, it will be truncated. |
| 5577 |
If the padding string is not set, spaces will be used. |
| 5578 |
"," |
| 5579 |
RPAD(TEXT, 10, '-') |
| 5580 |
" |
| 5581 |
|
| 5582 |
"Functions (String)","LTRIM"," |
| 5583 |
LTRIM(string [, charactersToTrimString]) |
| 5584 |
"," |
| 5585 |
Removes all leading spaces or other specified characters from a string, multiple characters can be specified. |
| 5586 |
"," |
| 5587 |
LTRIM(NAME) |
| 5588 |
LTRIM(NAME, ' _~'); |
| 5589 |
" |
| 5590 |
|
| 5591 |
"Functions (String)","RTRIM"," |
| 5592 |
RTRIM(string [, charactersToTrimString]) |
| 5593 |
"," |
| 5594 |
Removes all trailing spaces or other specified characters from a string, multiple characters can be specified. |
| 5595 |
"," |
| 5596 |
RTRIM(NAME) |
| 5597 |
RTRIM(NAME, ' _~'); |
| 5598 |
" |
| 5599 |
|
| 5600 |
"Functions (String)","BTRIM"," |
| 5601 |
BTRIM(string [, charactersToTrimString]) |
| 5602 |
"," |
| 5603 |
Removes all leading and trailing spaces or other specified characters from a string, |
| 5604 |
multiple characters can be specified. |
| 5605 |
"," |
| 5606 |
BTRIM(NAME) |
| 5607 |
BTRIM(NAME, ' _~'); |
| 5608 |
" |
| 5609 |
|
| 5610 |
"Functions (String)","TRIM"," |
| 5611 |
TRIM ( [ [ LEADING | TRAILING | BOTH ] [ characterToTrimString ] FROM ] string ) |
| 5612 |
"," |
| 5613 |
Removes all leading spaces, trailing spaces, or spaces at both ends from a string. |
| 5614 |
If character to trim is specified, these characters are removed instead of spaces, only one character can be specified. |
| 5615 |
To trim multiple different characters use [LTRIM](https://h2database.com/html/functions.html#ltrim), |
| 5616 |
[RTRIM](https://h2database.com/html/functions.html#rtrim), |
| 5617 |
or [BTRIM](https://h2database.com/html/functions.html#btrim). |
| 5618 |
|
| 5619 |
If neither LEADING, TRAILING, nor BOTH are specified, BOTH is implicit. |
| 5620 |
"," |
| 5621 |
TRIM(NAME) |
| 5622 |
TRIM(LEADING FROM NAME) |
| 5623 |
TRIM(BOTH '_' FROM NAME) |
| 5624 |
" |
| 5625 |
|
| 5626 |
"Functions (String)","REGEXP_REPLACE"," |
| 5627 |
@h2@ REGEXP_REPLACE(inputString, regexString, replacementString [, flagsString]) |
| 5628 |
"," |
| 5629 |
Replaces each substring that matches a regular expression. |
| 5630 |
For details, see the Java ""String.replaceAll()"" method. |
| 5631 |
If any parameter is null (except optional flagsString parameter), the result is null. |
| 5632 |
|
| 5633 |
Flags values are limited to 'i', 'c', 'n', 'm'. Other symbols cause exception. |
| 5634 |
Multiple symbols could be used in one flagsString parameter (like 'im'). |
| 5635 |
Later flags override first ones, for example 'ic' is equivalent to case sensitive matching 'c'. |
| 5636 |
|
| 5637 |
'i' enables case insensitive matching (Pattern.CASE_INSENSITIVE) |
| 5638 |
|
| 5639 |
'c' disables case insensitive matching (Pattern.CASE_INSENSITIVE) |
| 5640 |
|
| 5641 |
'n' allows the period to match the newline character (Pattern.DOTALL) |
| 5642 |
|
| 5643 |
'm' enables multiline mode (Pattern.MULTILINE) |
| 5644 |
|
| 5645 |
"," |
| 5646 |
REGEXP_REPLACE('Hello World', ' +', ' ') |
| 5647 |
REGEXP_REPLACE('Hello WWWWorld', 'w+', 'W', 'i') |
| 5648 |
" |
| 5649 |
|
| 5650 |
"Functions (String)","REGEXP_LIKE"," |
| 5651 |
@h2@ REGEXP_LIKE(inputString, regexString [, flagsString]) |
| 5652 |
"," |
| 5653 |
Matches string to a regular expression. |
| 5654 |
For details, see the Java ""Matcher.find()"" method. |
| 5655 |
If any parameter is null (except optional flagsString parameter), the result is null. |
| 5656 |
|
| 5657 |
Flags values are limited to 'i', 'c', 'n', 'm'. Other symbols cause exception. |
| 5658 |
Multiple symbols could be used in one flagsString parameter (like 'im'). |
| 5659 |
Later flags override first ones, for example 'ic' is equivalent to case sensitive matching 'c'. |
| 5660 |
|
| 5661 |
'i' enables case insensitive matching (Pattern.CASE_INSENSITIVE) |
| 5662 |
|
| 5663 |
'c' disables case insensitive matching (Pattern.CASE_INSENSITIVE) |
| 5664 |
|
| 5665 |
'n' allows the period to match the newline character (Pattern.DOTALL) |
| 5666 |
|
| 5667 |
'm' enables multiline mode (Pattern.MULTILINE) |
| 5668 |
|
| 5669 |
"," |
| 5670 |
REGEXP_LIKE('Hello World', '[A-Z ]*', 'i') |
| 5671 |
" |
| 5672 |
|
| 5673 |
"Functions (String)","REGEXP_SUBSTR"," |
| 5674 |
@h2@ REGEXP_SUBSTR(inputString, regexString [, positionInt, occurrenceInt, flagsString, groupInt]) |
| 5675 |
"," |
| 5676 |
Matches string to a regular expression and returns the matched substring. |
| 5677 |
For details, see the java.util.regex.Pattern and related functionality. |
| 5678 |
|
| 5679 |
The parameter position specifies where in inputString the match should start. Occurrence indicates |
| 5680 |
which occurrence of pattern in inputString to search for. |
| 5681 |
|
| 5682 |
Flags values are limited to 'i', 'c', 'n', 'm'. Other symbols cause exception. |
| 5683 |
Multiple symbols could be used in one flagsString parameter (like 'im'). |
| 5684 |
Later flags override first ones, for example 'ic' is equivalent to case sensitive matching 'c'. |
| 5685 |
|
| 5686 |
'i' enables case insensitive matching (Pattern.CASE_INSENSITIVE) |
| 5687 |
|
| 5688 |
'c' disables case insensitive matching (Pattern.CASE_INSENSITIVE) |
| 5689 |
|
| 5690 |
'n' allows the period to match the newline character (Pattern.DOTALL) |
| 5691 |
|
| 5692 |
'm' enables multiline mode (Pattern.MULTILINE) |
| 5693 |
|
| 5694 |
If the pattern has groups, the group parameter can be used to specify which group to return. |
| 5695 |
|
| 5696 |
"," |
| 5697 |
REGEXP_SUBSTR('2020-10-01', '\d{4}') |
| 5698 |
REGEXP_SUBSTR('2020-10-01', '(\d{4})-(\d{2})-(\d{2})', 1, 1, NULL, 2) |
| 5699 |
" |
| 5700 |
|
| 5701 |
"Functions (String)","REPEAT"," |
| 5702 |
@h2@ REPEAT(string, int) |
| 5703 |
"," |
| 5704 |
Returns a string repeated some number of times. |
| 5705 |
"," |
| 5706 |
REPEAT(NAME || ' ', 10) |
| 5707 |
" |
| 5708 |
|
| 5709 |
"Functions (String)","REPLACE"," |
| 5710 |
@h2@ REPLACE(string, searchString [, replacementString]) |
| 5711 |
"," |
| 5712 |
Replaces all occurrences of a search string in a text with another string. |
| 5713 |
If no replacement is specified, the search string is removed from the original string. |
| 5714 |
If any parameter is null, the result is null. |
| 5715 |
"," |
| 5716 |
REPLACE(NAME, ' ') |
| 5717 |
" |
| 5718 |
|
| 5719 |
"Functions (String)","SOUNDEX"," |
| 5720 |
@h2@ SOUNDEX(string) |
| 5721 |
"," |
| 5722 |
Returns a four character upper-case code representing the sound of a string as pronounced in English. |
| 5723 |
This method returns a string, or null if parameter is null. |
| 5724 |
See https://en.wikipedia.org/wiki/Soundex for more information. |
| 5725 |
"," |
| 5726 |
SOUNDEX(NAME) |
| 5727 |
" |
| 5728 |
|
| 5729 |
"Functions (String)","SPACE"," |
| 5730 |
@h2@ SPACE(int) |
| 5731 |
"," |
| 5732 |
Returns a string consisting of a number of spaces. |
| 5733 |
"," |
| 5734 |
SPACE(80) |
| 5735 |
" |
| 5736 |
|
| 5737 |
"Functions (String)","STRINGDECODE"," |
| 5738 |
@h2@ STRINGDECODE(string) |
| 5739 |
"," |
| 5740 |
Converts a encoded string using the Java string literal encoding format. |
| 5741 |
Special characters are \b, \t, \n, \f, \r, \"", \\, \<octal>, \u<unicode>. |
| 5742 |
This method returns a string. |
| 5743 |
"," |
| 5744 |
CALL STRINGENCODE(STRINGDECODE('Lines 1\nLine 2')) |
| 5745 |
" |
| 5746 |
|
| 5747 |
"Functions (String)","STRINGENCODE"," |
| 5748 |
@h2@ STRINGENCODE(string) |
| 5749 |
"," |
| 5750 |
Encodes special characters in a string using the Java string literal encoding format. |
| 5751 |
Special characters are \b, \t, \n, \f, \r, \"", \\, \<octal>, \u<unicode>. |
| 5752 |
This method returns a string. |
| 5753 |
"," |
| 5754 |
CALL STRINGENCODE(STRINGDECODE('Lines 1\nLine 2')) |
| 5755 |
" |
| 5756 |
|
| 5757 |
"Functions (String)","STRINGTOUTF8"," |
| 5758 |
@h2@ STRINGTOUTF8(string) |
| 5759 |
"," |
| 5760 |
Encodes a string to a byte array using the UTF8 encoding format. |
| 5761 |
This method returns bytes. |
| 5762 |
"," |
| 5763 |
CALL UTF8TOSTRING(STRINGTOUTF8('This is a test')) |
| 5764 |
" |
| 5765 |
|
| 5766 |
"Functions (String)","SUBSTRING"," |
| 5767 |
SUBSTRING ( {string|bytes} FROM startInt [ FOR lengthInt ] ) |
| 5768 |
| @c@ { { SUBSTRING | SUBSTR } ( {string|bytes}, startInt [, lengthInt ] ) } |
| 5769 |
"," |
| 5770 |
Returns a substring of a string starting at a position. |
| 5771 |
If the start index is negative, then the start index is relative to the end of the string. |
| 5772 |
The length is optional. |
| 5773 |
"," |
| 5774 |
CALL SUBSTRING('[Hello]' FROM 2 FOR 5); |
| 5775 |
CALL SUBSTRING('hour' FROM 2); |
| 5776 |
" |
| 5777 |
|
| 5778 |
"Functions (String)","UTF8TOSTRING"," |
| 5779 |
@h2@ UTF8TOSTRING(bytes) |
| 5780 |
"," |
| 5781 |
Decodes a byte array in the UTF8 format to a string. |
| 5782 |
"," |
| 5783 |
CALL UTF8TOSTRING(STRINGTOUTF8('This is a test')) |
| 5784 |
" |
| 5785 |
|
| 5786 |
"Functions (String)","QUOTE_IDENT"," |
| 5787 |
@h2@ QUOTE_IDENT(string) |
| 5788 |
"," |
| 5789 |
Quotes the specified identifier. |
| 5790 |
Identifier is surrounded by double quotes. |
| 5791 |
If identifier contains double quotes they are repeated twice. |
| 5792 |
"," |
| 5793 |
QUOTE_IDENT('Column 1') |
| 5794 |
" |
| 5795 |
|
| 5796 |
"Functions (String)","XMLATTR"," |
| 5797 |
@h2@ XMLATTR(nameString, valueString) |
| 5798 |
"," |
| 5799 |
Creates an XML attribute element of the form ""name=value"". |
| 5800 |
The value is encoded as XML text. |
| 5801 |
This method returns a string. |
| 5802 |
"," |
| 5803 |
CALL XMLNODE('a', XMLATTR('href', 'https://h2database.com')) |
| 5804 |
" |
| 5805 |
|
| 5806 |
"Functions (String)","XMLNODE"," |
| 5807 |
@h2@ XMLNODE(elementString [, attributesString [, contentString [, indentBoolean]]]) |
| 5808 |
"," |
| 5809 |
Create an XML node element. |
| 5810 |
An empty or null attribute string means no attributes are set. |
| 5811 |
An empty or null content string means the node is empty. |
| 5812 |
The content is indented by default if it contains a newline. |
| 5813 |
This method returns a string. |
| 5814 |
"," |
| 5815 |
CALL XMLNODE('a', XMLATTR('href', 'https://h2database.com'), 'H2') |
| 5816 |
" |
| 5817 |
|
| 5818 |
"Functions (String)","XMLCOMMENT"," |
| 5819 |
@h2@ XMLCOMMENT(commentString) |
| 5820 |
"," |
| 5821 |
Creates an XML comment. |
| 5822 |
Two dashes (""--"") are converted to ""- -"". |
| 5823 |
This method returns a string. |
| 5824 |
"," |
| 5825 |
CALL XMLCOMMENT('Test') |
| 5826 |
" |
| 5827 |
|
| 5828 |
"Functions (String)","XMLCDATA"," |
| 5829 |
@h2@ XMLCDATA(valueString) |
| 5830 |
"," |
| 5831 |
Creates an XML CDATA element. |
| 5832 |
If the value contains ""]]>"", an XML text element is created instead. |
| 5833 |
This method returns a string. |
| 5834 |
"," |
| 5835 |
CALL XMLCDATA('data') |
| 5836 |
" |
| 5837 |
|
| 5838 |
"Functions (String)","XMLSTARTDOC"," |
| 5839 |
@h2@ XMLSTARTDOC() |
| 5840 |
"," |
| 5841 |
Returns the XML declaration. |
| 5842 |
The result is always ""<?xml version=""1.0""?>"". |
| 5843 |
"," |
| 5844 |
CALL XMLSTARTDOC() |
| 5845 |
" |
| 5846 |
|
| 5847 |
"Functions (String)","XMLTEXT"," |
| 5848 |
@h2@ XMLTEXT(valueString [, escapeNewlineBoolean]) |
| 5849 |
"," |
| 5850 |
Creates an XML text element. |
| 5851 |
If enabled, newline and linefeed is converted to an XML entity (&#). |
| 5852 |
This method returns a string. |
| 5853 |
"," |
| 5854 |
CALL XMLTEXT('test') |
| 5855 |
" |
| 5856 |
|
| 5857 |
"Functions (String)","TO_CHAR"," |
| 5858 |
@c@ TO_CHAR(value [, formatString[, nlsParamString]]) |
| 5859 |
"," |
| 5860 |
Oracle-compatible TO_CHAR function that can format a timestamp, a number, or text. |
| 5861 |
"," |
| 5862 |
CALL TO_CHAR(TIMESTAMP '2010-01-01 00:00:00', 'DD MON, YYYY') |
| 5863 |
" |
| 5864 |
|
| 5865 |
"Functions (String)","TRANSLATE"," |
| 5866 |
@c@ TRANSLATE(value, searchString, replacementString) |
| 5867 |
"," |
| 5868 |
Oracle-compatible TRANSLATE function that replaces a sequence of characters in a string with another set of characters. |
| 5869 |
"," |
| 5870 |
CALL TRANSLATE('Hello world', 'eo', 'EO') |
| 5871 |
" |
| 5872 |
|
| 5873 |
"Functions (Time and Date)","CURRENT_DATE"," |
| 5874 |
CURRENT_DATE |
| 5875 |
"," |
| 5876 |
Returns the current date. |
| 5877 |
|
| 5878 |
These functions return the same value within a transaction (default) |
| 5879 |
or within a command depending on database mode. |
| 5880 |
|
| 5881 |
[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value |
| 5882 |
for these functions using the same original UTC timestamp of transaction. |
| 5883 |
"," |
| 5884 |
CURRENT_DATE |
| 5885 |
" |
| 5886 |
|
| 5887 |
"Functions (Time and Date)","CURRENT_TIME"," |
| 5888 |
CURRENT_TIME [ (int) ] |
| 5889 |
"," |
| 5890 |
Returns the current time with time zone. |
| 5891 |
If fractional seconds precision is specified it should be from 0 to 9, 0 is default. |
| 5892 |
The specified value can be used only to limit precision of a result. |
| 5893 |
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher. |
| 5894 |
Higher precision is not available before Java 9. |
| 5895 |
|
| 5896 |
This function returns the same value within a transaction (default) |
| 5897 |
or within a command depending on database mode. |
| 5898 |
|
| 5899 |
[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value |
| 5900 |
for this function using the same original UTC timestamp of transaction. |
| 5901 |
"," |
| 5902 |
CURRENT_TIME |
| 5903 |
CURRENT_TIME(9) |
| 5904 |
" |
| 5905 |
|
| 5906 |
"Functions (Time and Date)","CURRENT_TIMESTAMP"," |
| 5907 |
CURRENT_TIMESTAMP [ (int) ] |
| 5908 |
"," |
| 5909 |
Returns the current timestamp with time zone. |
| 5910 |
Time zone offset is set to a current time zone offset. |
| 5911 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 5912 |
The specified value can be used only to limit precision of a result. |
| 5913 |
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher. |
| 5914 |
Higher precision is not available before Java 9. |
| 5915 |
|
| 5916 |
This function returns the same value within a transaction (default) |
| 5917 |
or within a command depending on database mode. |
| 5918 |
|
| 5919 |
[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value |
| 5920 |
for this function using the same original UTC timestamp of transaction. |
| 5921 |
"," |
| 5922 |
CURRENT_TIMESTAMP |
| 5923 |
CURRENT_TIMESTAMP(9) |
| 5924 |
" |
| 5925 |
|
| 5926 |
"Functions (Time and Date)","LOCALTIME"," |
| 5927 |
LOCALTIME [ (int) ] |
| 5928 |
"," |
| 5929 |
Returns the current time without time zone. |
| 5930 |
If fractional seconds precision is specified it should be from 0 to 9, 0 is default. |
| 5931 |
The specified value can be used only to limit precision of a result. |
| 5932 |
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher. |
| 5933 |
Higher precision is not available before Java 9. |
| 5934 |
|
| 5935 |
These functions return the same value within a transaction (default) |
| 5936 |
or within a command depending on database mode. |
| 5937 |
|
| 5938 |
[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value |
| 5939 |
for these functions using the same original UTC timestamp of transaction. |
| 5940 |
"," |
| 5941 |
LOCALTIME |
| 5942 |
LOCALTIME(9) |
| 5943 |
" |
| 5944 |
|
| 5945 |
"Functions (Time and Date)","LOCALTIMESTAMP"," |
| 5946 |
LOCALTIMESTAMP [ (int) ] |
| 5947 |
"," |
| 5948 |
Returns the current timestamp without time zone. |
| 5949 |
If fractional seconds precision is specified it should be from 0 to 9, 6 is default. |
| 5950 |
The specified value can be used only to limit precision of a result. |
| 5951 |
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher. |
| 5952 |
Higher precision is not available before Java 9. |
| 5953 |
|
| 5954 |
The returned value has date and time without time zone information. |
| 5955 |
If time zone has DST transitions the returned values are ambiguous during transition from DST to normal time. |
| 5956 |
For absolute timestamps use the [CURRENT_TIMESTAMP](https://h2database.com/html/functions.html#current_timestamp) |
| 5957 |
function and [TIMESTAMP WITH TIME ZONE](https://h2database.com/html/datatypes.html#timestamp_with_time_zone_type) |
| 5958 |
data type. |
| 5959 |
|
| 5960 |
These functions return the same value within a transaction (default) |
| 5961 |
or within a command depending on database mode. |
| 5962 |
|
| 5963 |
[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) reevaluates the value |
| 5964 |
for these functions using the same original UTC timestamp of transaction. |
| 5965 |
"," |
| 5966 |
LOCALTIMESTAMP |
| 5967 |
LOCALTIMESTAMP(9) |
| 5968 |
" |
| 5969 |
|
| 5970 |
"Functions (Time and Date)","DATEADD"," |
| 5971 |
@h2@ { DATEADD| TIMESTAMPADD } @h2@ (datetimeField, addIntLong, dateAndTime) |
| 5972 |
"," |
| 5973 |
Adds units to a date-time value. The datetimeField indicates the unit. |
| 5974 |
Use negative values to subtract units. |
| 5975 |
addIntLong may be a long value when manipulating milliseconds, |
| 5976 |
microseconds, or nanoseconds otherwise its range is restricted to int. |
| 5977 |
This method returns a value with the same type as specified value if unit is compatible with this value. |
| 5978 |
If specified field is a HOUR, MINUTE, SECOND, MILLISECOND, etc and value is a DATE value DATEADD returns combined TIMESTAMP. |
| 5979 |
Fields DAY, MONTH, YEAR, WEEK, etc are not allowed for TIME values. |
| 5980 |
Fields TIMEZONE_HOUR, TIMEZONE_MINUTE, and TIMEZONE_SECOND are only allowed for TIMESTAMP WITH TIME ZONE values. |
| 5981 |
"," |
| 5982 |
DATEADD(MONTH, 1, DATE '2001-01-31') |
| 5983 |
" |
| 5984 |
|
| 5985 |
"Functions (Time and Date)","DATEDIFF"," |
| 5986 |
@h2@ { DATEDIFF | TIMESTAMPDIFF } @h2@ (datetimeField, aDateAndTime, bDateAndTime) |
| 5987 |
"," |
| 5988 |
Returns the number of crossed unit boundaries between two date/time values. |
| 5989 |
This method returns a long. |
| 5990 |
The datetimeField indicates the unit. |
| 5991 |
Only TIMEZONE_HOUR, TIMEZONE_MINUTE, and TIMEZONE_SECOND fields use the time zone offset component. |
| 5992 |
With all other fields if date/time values have time zone offset component it is ignored. |
| 5993 |
"," |
| 5994 |
DATEDIFF(YEAR, T1.CREATED, T2.CREATED) |
| 5995 |
" |
| 5996 |
|
| 5997 |
"Functions (Time and Date)","DATE_TRUNC"," |
| 5998 |
@h2@ DATE_TRUNC(datetimeField, dateAndTime) |
| 5999 |
"," |
| 6000 |
Truncates the specified date-time value to the specified field. |
| 6001 |
"," |
| 6002 |
DATE_TRUNC(DAY, TIMESTAMP '2010-01-03 10:40:00'); |
| 6003 |
" |
| 6004 |
|
| 6005 |
"Functions (Time and Date)","LAST_DAY"," |
| 6006 |
@h2@ LAST_DAY(date | timestamp | timestampWithTimeZone | string) |
| 6007 |
"," |
| 6008 |
Returns the last day of the month that contains the specified date-time value. |
| 6009 |
This function returns a date. |
| 6010 |
"," |
| 6011 |
LAST_DAY(DAY, DATE '2020-02-05'); |
| 6012 |
" |
| 6013 |
|
| 6014 |
"Functions (Time and Date)","DAYNAME"," |
| 6015 |
@h2@ DAYNAME(dateAndTime) |
| 6016 |
"," |
| 6017 |
Returns the name of the day (in English). |
| 6018 |
"," |
| 6019 |
DAYNAME(CREATED) |
| 6020 |
" |
| 6021 |
|
| 6022 |
"Functions (Time and Date)","DAY_OF_MONTH"," |
| 6023 |
@c@ DAY_OF_MONTH({dateAndTime|interval}) |
| 6024 |
"," |
| 6025 |
Returns the day of the month (1-31). |
| 6026 |
|
| 6027 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6028 |
"," |
| 6029 |
DAY_OF_MONTH(CREATED) |
| 6030 |
" |
| 6031 |
|
| 6032 |
"Functions (Time and Date)","DAY_OF_WEEK"," |
| 6033 |
@c@ DAY_OF_WEEK(dateAndTime) |
| 6034 |
"," |
| 6035 |
Returns the day of the week (1-7), locale-specific. |
| 6036 |
|
| 6037 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6038 |
"," |
| 6039 |
DAY_OF_WEEK(CREATED) |
| 6040 |
" |
| 6041 |
|
| 6042 |
"Functions (Time and Date)","ISO_DAY_OF_WEEK"," |
| 6043 |
@c@ ISO_DAY_OF_WEEK(dateAndTime) |
| 6044 |
"," |
| 6045 |
Returns the ISO day of the week (1 means Monday). |
| 6046 |
|
| 6047 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6048 |
"," |
| 6049 |
ISO_DAY_OF_WEEK(CREATED) |
| 6050 |
" |
| 6051 |
|
| 6052 |
"Functions (Time and Date)","DAY_OF_YEAR"," |
| 6053 |
@c@ DAY_OF_YEAR({dateAndTime|interval}) |
| 6054 |
"," |
| 6055 |
Returns the day of the year (1-366). |
| 6056 |
|
| 6057 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6058 |
"," |
| 6059 |
DAY_OF_YEAR(CREATED) |
| 6060 |
" |
| 6061 |
|
| 6062 |
"Functions (Time and Date)","EXTRACT"," |
| 6063 |
EXTRACT ( datetimeField FROM { dateAndTime | interval }) |
| 6064 |
"," |
| 6065 |
Returns a value of the specific time unit from a date/time value. |
| 6066 |
This method returns a numeric value with EPOCH field and |
| 6067 |
an int for all other fields. |
| 6068 |
"," |
| 6069 |
EXTRACT(SECOND FROM CURRENT_TIMESTAMP) |
| 6070 |
" |
| 6071 |
|
| 6072 |
"Functions (Time and Date)","FORMATDATETIME"," |
| 6073 |
@h2@ FORMATDATETIME ( dateAndTime, formatString |
| 6074 |
[ , localeString [ , timeZoneString ] ] ) |
| 6075 |
"," |
| 6076 |
Formats a date, time or timestamp as a string. |
| 6077 |
The most important format characters are: |
| 6078 |
y year, M month, d day, H hour, m minute, s second. |
| 6079 |
For details of the format, see ""java.time.format.DateTimeFormatter"". |
| 6080 |
Allowed format characters depend on data type of passed date/time value. |
| 6081 |
|
| 6082 |
If timeZoneString is specified, it is used in formatted string if formatString has time zone. |
| 6083 |
For TIME and TIME WITH TIME ZONE values the specified time zone must have a fixed offset. |
| 6084 |
|
| 6085 |
If TIME WITH TIME ZONE is passed and timeZoneString is specified, |
| 6086 |
the time is converted to the specified time zone offset and its UTC value is preserved. |
| 6087 |
If TIMESTAMP WITH TIME ZONE is passed and timeZoneString is specified, |
| 6088 |
the timestamp is converted to the specified time zone and its UTC value is preserved. |
| 6089 |
|
| 6090 |
This method returns a string. |
| 6091 |
|
| 6092 |
See also [cast specification](https://h2database.com/html/grammar.html#cast_specification). |
| 6093 |
"," |
| 6094 |
CALL FORMATDATETIME(TIMESTAMP '2001-02-03 04:05:06', |
| 6095 |
'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT') |
| 6096 |
" |
| 6097 |
|
| 6098 |
"Functions (Time and Date)","HOUR"," |
| 6099 |
@c@ HOUR({dateAndTime|interval}) |
| 6100 |
"," |
| 6101 |
Returns the hour (0-23) from a date/time value. |
| 6102 |
|
| 6103 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6104 |
"," |
| 6105 |
HOUR(CREATED) |
| 6106 |
" |
| 6107 |
|
| 6108 |
"Functions (Time and Date)","MINUTE"," |
| 6109 |
@c@ MINUTE({dateAndTime|interval}) |
| 6110 |
"," |
| 6111 |
Returns the minute (0-59) from a date/time value. |
| 6112 |
|
| 6113 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6114 |
"," |
| 6115 |
MINUTE(CREATED) |
| 6116 |
" |
| 6117 |
|
| 6118 |
"Functions (Time and Date)","MONTH"," |
| 6119 |
@c@ MONTH({dateAndTime|interval}) |
| 6120 |
"," |
| 6121 |
Returns the month (1-12) from a date/time value. |
| 6122 |
|
| 6123 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6124 |
"," |
| 6125 |
MONTH(CREATED) |
| 6126 |
" |
| 6127 |
|
| 6128 |
"Functions (Time and Date)","MONTHNAME"," |
| 6129 |
@h2@ MONTHNAME(dateAndTime) |
| 6130 |
"," |
| 6131 |
Returns the name of the month (in English). |
| 6132 |
"," |
| 6133 |
MONTHNAME(CREATED) |
| 6134 |
" |
| 6135 |
|
| 6136 |
"Functions (Time and Date)","PARSEDATETIME"," |
| 6137 |
@h2@ PARSEDATETIME(string, formatString |
| 6138 |
[, localeString [, timeZoneString]]) |
| 6139 |
"," |
| 6140 |
Parses a string and returns a TIMESTAMP WITH TIME ZONE value. |
| 6141 |
The most important format characters are: |
| 6142 |
y year, M month, d day, H hour, m minute, s second. |
| 6143 |
For details of the format, see ""java.time.format.DateTimeFormatter"". |
| 6144 |
|
| 6145 |
If timeZoneString is specified, it is used as default. |
| 6146 |
|
| 6147 |
See also [cast specification](https://h2database.com/html/grammar.html#cast_specification). |
| 6148 |
"," |
| 6149 |
CALL PARSEDATETIME('Sat, 3 Feb 2001 03:05:06 GMT', |
| 6150 |
'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT') |
| 6151 |
" |
| 6152 |
|
| 6153 |
"Functions (Time and Date)","QUARTER"," |
| 6154 |
@c@ QUARTER(dateAndTime) |
| 6155 |
"," |
| 6156 |
Returns the quarter (1-4) from a date/time value. |
| 6157 |
|
| 6158 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6159 |
"," |
| 6160 |
QUARTER(CREATED) |
| 6161 |
" |
| 6162 |
|
| 6163 |
"Functions (Time and Date)","SECOND"," |
| 6164 |
@c@ SECOND(dateAndTime) |
| 6165 |
"," |
| 6166 |
Returns the second (0-59) from a date/time value. |
| 6167 |
|
| 6168 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6169 |
"," |
| 6170 |
SECOND(CREATED|interval) |
| 6171 |
" |
| 6172 |
|
| 6173 |
"Functions (Time and Date)","WEEK"," |
| 6174 |
@c@ WEEK(dateAndTime) |
| 6175 |
"," |
| 6176 |
Returns the week (1-53) from a date/time value. |
| 6177 |
|
| 6178 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6179 |
|
| 6180 |
This function uses the current system locale. |
| 6181 |
"," |
| 6182 |
WEEK(CREATED) |
| 6183 |
" |
| 6184 |
|
| 6185 |
"Functions (Time and Date)","ISO_WEEK"," |
| 6186 |
@c@ ISO_WEEK(dateAndTime) |
| 6187 |
"," |
| 6188 |
Returns the ISO week (1-53) from a date/time value. |
| 6189 |
|
| 6190 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6191 |
|
| 6192 |
This function uses the ISO definition when |
| 6193 |
first week of year should have at least four days |
| 6194 |
and week is started with Monday. |
| 6195 |
"," |
| 6196 |
ISO_WEEK(CREATED) |
| 6197 |
" |
| 6198 |
|
| 6199 |
"Functions (Time and Date)","YEAR"," |
| 6200 |
@c@ YEAR({dateAndTime|interval}) |
| 6201 |
"," |
| 6202 |
Returns the year from a date/time value. |
| 6203 |
|
| 6204 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6205 |
"," |
| 6206 |
YEAR(CREATED) |
| 6207 |
" |
| 6208 |
|
| 6209 |
"Functions (Time and Date)","ISO_YEAR"," |
| 6210 |
@c@ ISO_YEAR(dateAndTime) |
| 6211 |
"," |
| 6212 |
Returns the ISO week year from a date/time value. |
| 6213 |
|
| 6214 |
This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it. |
| 6215 |
"," |
| 6216 |
ISO_YEAR(CREATED) |
| 6217 |
" |
| 6218 |
|
| 6219 |
"Functions (System)","ABORT_SESSION"," |
| 6220 |
@h2@ ABORT_SESSION(sessionInt) |
| 6221 |
"," |
| 6222 |
Cancels the currently executing statement of another session. Closes the session and releases the allocated resources. |
| 6223 |
Returns true if the session was closed, false if no session with the given id was found. |
| 6224 |
|
| 6225 |
If a client was connected while its session was aborted it will see an error. |
| 6226 |
|
| 6227 |
Admin rights are required to execute this command. |
| 6228 |
"," |
| 6229 |
CALL ABORT_SESSION(3) |
| 6230 |
" |
| 6231 |
|
| 6232 |
"Functions (System)","ARRAY_GET"," |
| 6233 |
@c@ ARRAY_GET(arrayExpression, indexExpression) |
| 6234 |
"," |
| 6235 |
Returns element at the specified 1-based index from an array. |
| 6236 |
|
| 6237 |
This function is deprecated, use |
| 6238 |
[array element reference](https://www.h2database.com/html/grammar.html#array_element_reference) instead of it. |
| 6239 |
|
| 6240 |
Returns NULL if array or index is NULL. |
| 6241 |
"," |
| 6242 |
CALL ARRAY_GET(ARRAY['Hello', 'World'], 2) |
| 6243 |
" |
| 6244 |
|
| 6245 |
"Functions (System)","CARDINALITY"," |
| 6246 |
{ CARDINALITY | @c@ { ARRAY_LENGTH } } (arrayExpression) |
| 6247 |
"," |
| 6248 |
Returns the length of an array or JSON array. |
| 6249 |
Returns NULL if the specified array is NULL. |
| 6250 |
"," |
| 6251 |
CALL CARDINALITY(ARRAY['Hello', 'World']) |
| 6252 |
CALL CARDINALITY(JSON '[1, 2, 3]') |
| 6253 |
" |
| 6254 |
|
| 6255 |
"Functions (System)","ARRAY_CONTAINS"," |
| 6256 |
@h2@ ARRAY_CONTAINS(arrayExpression, value) |
| 6257 |
"," |
| 6258 |
Returns a boolean TRUE if the array contains the value or FALSE if it does not contain it. |
| 6259 |
Returns NULL if the specified array is NULL. |
| 6260 |
"," |
| 6261 |
CALL ARRAY_CONTAINS(ARRAY['Hello', 'World'], 'Hello') |
| 6262 |
" |
| 6263 |
|
| 6264 |
"Functions (System)","ARRAY_CAT"," |
| 6265 |
@c@ ARRAY_CAT(arrayExpression, arrayExpression) |
| 6266 |
"," |
| 6267 |
Returns the concatenation of two arrays. |
| 6268 |
|
| 6269 |
This function is deprecated, use ""||"" instead of it. |
| 6270 |
|
| 6271 |
Returns NULL if any parameter is NULL. |
| 6272 |
"," |
| 6273 |
CALL ARRAY_CAT(ARRAY[1, 2], ARRAY[3, 4]) |
| 6274 |
" |
| 6275 |
|
| 6276 |
"Functions (System)","ARRAY_APPEND"," |
| 6277 |
@c@ ARRAY_APPEND(arrayExpression, value) |
| 6278 |
"," |
| 6279 |
Append an element to the end of an array. |
| 6280 |
|
| 6281 |
This function is deprecated, use ""||"" instead of it. |
| 6282 |
|
| 6283 |
Returns NULL if any parameter is NULL. |
| 6284 |
"," |
| 6285 |
CALL ARRAY_APPEND(ARRAY[1, 2], 3) |
| 6286 |
" |
| 6287 |
|
| 6288 |
"Functions (System)","ARRAY_MAX_CARDINALITY"," |
| 6289 |
ARRAY_MAX_CARDINALITY(arrayExpression) |
| 6290 |
"," |
| 6291 |
Returns the maximum allowed array cardinality (length) of the declared data type of argument. |
| 6292 |
"," |
| 6293 |
SELECT ARRAY_MAX_CARDINALITY(COL1) FROM TEST FETCH FIRST ROW ONLY; |
| 6294 |
" |
| 6295 |
|
| 6296 |
"Functions (System)","TRIM_ARRAY"," |
| 6297 |
TRIM_ARRAY(arrayExpression, int) |
| 6298 |
"," |
| 6299 |
Removes the specified number of elements from the end of the array. |
| 6300 |
|
| 6301 |
Returns NULL if second parameter is NULL or if first parameter is NULL and second parameter is not negative. |
| 6302 |
Throws exception if second parameter is negative or larger than number of elements in array. |
| 6303 |
Otherwise returns the truncated array. |
| 6304 |
"," |
| 6305 |
CALL TRIM_ARRAY(ARRAY[1, 2, 3, 4], 1) |
| 6306 |
" |
| 6307 |
|
| 6308 |
"Functions (System)","ARRAY_SLICE"," |
| 6309 |
@h2@ ARRAY_SLICE(arrayExpression, lowerBoundInt, upperBoundInt) |
| 6310 |
"," |
| 6311 |
Returns elements from the array as specified by the lower and upper bound parameters. |
| 6312 |
Both parameters are inclusive and the first element has index 1, i.e. ARRAY_SLICE(a, 2, 2) has only the second element. |
| 6313 |
Returns NULL if any parameter is NULL or if an index is out of bounds. |
| 6314 |
"," |
| 6315 |
CALL ARRAY_SLICE(ARRAY[1, 2, 3, 4], 1, 3) |
| 6316 |
" |
| 6317 |
|
| 6318 |
"Functions (System)","AUTOCOMMIT"," |
| 6319 |
@h2@ AUTOCOMMIT() |
| 6320 |
"," |
| 6321 |
Returns true if auto commit is switched on for this session. |
| 6322 |
"," |
| 6323 |
AUTOCOMMIT() |
| 6324 |
" |
| 6325 |
|
| 6326 |
"Functions (System)","CANCEL_SESSION"," |
| 6327 |
@h2@ CANCEL_SESSION(sessionInt) |
| 6328 |
"," |
| 6329 |
Cancels the currently executing statement of another session. |
| 6330 |
Returns true if the statement was canceled, false if the session is closed or no statement is currently executing. |
| 6331 |
|
| 6332 |
Admin rights are required to execute this command. |
| 6333 |
"," |
| 6334 |
CANCEL_SESSION(3) |
| 6335 |
" |
| 6336 |
|
| 6337 |
"Functions (System)","CASEWHEN Function"," |
| 6338 |
@c@ CASEWHEN(boolean, aValue, bValue) |
| 6339 |
"," |
| 6340 |
Returns 'aValue' if the boolean expression is true, otherwise 'bValue'. |
| 6341 |
|
| 6342 |
This function is deprecated, use [CASE](https://h2database.com/html/grammar.html#searched_case) instead of it. |
| 6343 |
"," |
| 6344 |
CASEWHEN(ID=1, 'A', 'B') |
| 6345 |
" |
| 6346 |
|
| 6347 |
"Functions (System)","COALESCE"," |
| 6348 |
{ COALESCE | @c@ { NVL } } (aValue, bValue [,...]) |
| 6349 |
| @c@ IFNULL(aValue, bValue) |
| 6350 |
"," |
| 6351 |
Returns the first value that is not null. |
| 6352 |
"," |
| 6353 |
COALESCE(A, B, C) |
| 6354 |
" |
| 6355 |
|
| 6356 |
"Functions (System)","CONVERT"," |
| 6357 |
@c@ CONVERT(value, dataTypeOrDomain) |
| 6358 |
"," |
| 6359 |
Converts a value to another data type. |
| 6360 |
|
| 6361 |
This function is deprecated, use [CAST](https://h2database.com/html/grammar.html#cast_specification) instead of it. |
| 6362 |
"," |
| 6363 |
CONVERT(NAME, INT) |
| 6364 |
" |
| 6365 |
|
| 6366 |
"Functions (System)","CURRVAL"," |
| 6367 |
@c@ CURRVAL( [ schemaNameString, ] sequenceString ) |
| 6368 |
"," |
| 6369 |
Returns the latest generated value of the sequence for the current session. |
| 6370 |
Current value may only be requested after generation of the sequence value in the current session. |
| 6371 |
This method exists only for compatibility, when it isn't required use |
| 6372 |
[CURRENT VALUE FOR sequenceName](https://h2database.com/html/grammar.html#sequence_value_expression) |
| 6373 |
instead. |
| 6374 |
If the schema name is not set, the current schema is used. |
| 6375 |
When sequence is not found, the uppercase name is also checked. |
| 6376 |
This method returns a long. |
| 6377 |
"," |
| 6378 |
CURRVAL('TEST_SEQ') |
| 6379 |
" |
| 6380 |
|
| 6381 |
"Functions (System)","CSVWRITE"," |
| 6382 |
@h2@ CSVWRITE ( fileNameString, queryString [, csvOptions [, lineSepString] ] ) |
| 6383 |
"," |
| 6384 |
Writes a CSV (comma separated values). The file is overwritten if it exists. |
| 6385 |
If only a file name is specified, it will be written to the current working directory. |
| 6386 |
For each parameter, NULL means the default value should be used. |
| 6387 |
The default charset is the default value for this system, and the default field separator is a comma. |
| 6388 |
|
| 6389 |
The values are converted to text using the default string representation; |
| 6390 |
if another conversion is required you need to change the select statement accordingly. |
| 6391 |
The parameter nullString is used when writing NULL (by default nothing is written |
| 6392 |
when NULL appears). The default line separator is the default value for this |
| 6393 |
system (system property ""line.separator""). |
| 6394 |
|
| 6395 |
The returned value is the number or rows written. |
| 6396 |
Admin rights are required to execute this command. |
| 6397 |
"," |
| 6398 |
CALL CSVWRITE('data/test.csv', 'SELECT * FROM TEST'); |
| 6399 |
CALL CSVWRITE('data/test2.csv', 'SELECT * FROM TEST', 'charset=UTF-8 fieldSeparator=|'); |
| 6400 |
-- Write a tab-separated file |
| 6401 |
CALL CSVWRITE('data/test.tsv', 'SELECT * FROM TEST', 'charset=UTF-8 fieldSeparator=' || CHAR(9)); |
| 6402 |
" |
| 6403 |
|
| 6404 |
"Functions (System)","CURRENT_SCHEMA"," |
| 6405 |
CURRENT_SCHEMA | @c@ SCHEMA() |
| 6406 |
"," |
| 6407 |
Returns the name of the default schema for this session. |
| 6408 |
"," |
| 6409 |
CALL CURRENT_SCHEMA |
| 6410 |
" |
| 6411 |
|
| 6412 |
"Functions (System)","CURRENT_CATALOG"," |
| 6413 |
CURRENT_CATALOG | @c@ DATABASE() |
| 6414 |
"," |
| 6415 |
Returns the name of the database. |
| 6416 |
"," |
| 6417 |
CALL CURRENT_CATALOG |
| 6418 |
" |
| 6419 |
|
| 6420 |
"Functions (System)","DATABASE_PATH"," |
| 6421 |
@h2@ DATABASE_PATH() |
| 6422 |
"," |
| 6423 |
Returns the directory of the database files and the database name, if it is file based. |
| 6424 |
Returns NULL otherwise. |
| 6425 |
"," |
| 6426 |
CALL DATABASE_PATH(); |
| 6427 |
" |
| 6428 |
|
| 6429 |
"Functions (System)","DATA_TYPE_SQL"," |
| 6430 |
@h2@ DATA_TYPE_SQL |
| 6431 |
@h2@ (objectSchemaString, objectNameString, objectTypeString, typeIdentifierString) |
| 6432 |
"," |
| 6433 |
Returns SQL representation of data type of the specified |
| 6434 |
constant, domain, table column, routine result or argument. |
| 6435 |
|
| 6436 |
For constants object type is 'CONSTANT' and type identifier is the value of |
| 6437 |
""INFORMATION_SCHEMA.CONSTANTS.DTD_IDENTIFIER"". |
| 6438 |
|
| 6439 |
For domains object type is 'DOMAIN' and type identifier is the value of |
| 6440 |
""INFORMATION_SCHEMA.DOMAINS.DTD_IDENTIFIER"". |
| 6441 |
|
| 6442 |
For columns object type is 'TABLE' and type identifier is the value of |
| 6443 |
""INFORMATION_SCHEMA.COLUMNS.DTD_IDENTIFIER"". |
| 6444 |
|
| 6445 |
For routines object name is the value of ""INFORMATION_SCHEMA.ROUTINES.SPECIFIC_NAME"", |
| 6446 |
object type is 'ROUTINE', and type identifier is the value of |
| 6447 |
""INFORMATION_SCHEMA.ROUTINES.DTD_IDENTIFIER"" for data type of the result and the value of |
| 6448 |
""INFORMATION_SCHEMA.PARAMETERS.DTD_IDENTIFIER"" for data types of arguments. |
| 6449 |
Aggregate functions aren't supported by this function, because their data type isn't statically known. |
| 6450 |
|
| 6451 |
This function returns NULL if any argument is NULL, object type is not valid, or object isn't found. |
| 6452 |
"," |
| 6453 |
DATA_TYPE_SQL('PUBLIC', 'C', 'CONSTANT', 'TYPE') |
| 6454 |
DATA_TYPE_SQL('PUBLIC', 'D', 'DOMAIN', 'TYPE') |
| 6455 |
DATA_TYPE_SQL('PUBLIC', 'T', 'TABLE', '1') |
| 6456 |
DATA_TYPE_SQL('PUBLIC', 'R_1', 'ROUTINE', 'RESULT') |
| 6457 |
DATA_TYPE_SQL('PUBLIC', 'R_1', 'ROUTINE', '1') |
| 6458 |
COALESCE( |
| 6459 |
QUOTE_IDENT(DOMAIN_SCHEMA) || '.' || QUOTE_IDENT(DOMAIN_NAME), |
| 6460 |
DATA_TYPE_SQL(TABLE_SCHEMA, TABLE_NAME, 'TABLE', DTD_IDENTIFIER)) |
| 6461 |
" |
| 6462 |
|
| 6463 |
"Functions (System)","DB_OBJECT_ID"," |
| 6464 |
@h2@ DB_OBJECT_ID({{'ROLE'|'SETTING'|'SCHEMA'|'USER'}, objectNameString |
| 6465 |
| {'CONSTANT'|'CONSTRAINT'|'DOMAIN'|'INDEX'|'ROUTINE'|'SEQUENCE' |
| 6466 |
|'SYNONYM'|'TABLE'|'TRIGGER'}, schemaNameString, objectNameString }) |
| 6467 |
"," |
| 6468 |
Returns internal identifier of the specified database object as integer value or NULL if object doesn't exist. |
| 6469 |
|
| 6470 |
Admin rights are required to execute this function. |
| 6471 |
"," |
| 6472 |
CALL DB_OBJECT_ID('ROLE', 'MANAGER'); |
| 6473 |
CALL DB_OBJECT_ID('TABLE', 'PUBLIC', 'MY_TABLE'); |
| 6474 |
" |
| 6475 |
|
| 6476 |
"Functions (System)","DB_OBJECT_SQL"," |
| 6477 |
@h2@ DB_OBJECT_SQL({{'ROLE'|'SETTING'|'SCHEMA'|'USER'}, objectNameString |
| 6478 |
| {'CONSTANT'|'CONSTRAINT'|'DOMAIN'|'INDEX'|'ROUTINE'|'SEQUENCE' |
| 6479 |
|'SYNONYM'|'TABLE'|'TRIGGER'}, schemaNameString, objectNameString }) |
| 6480 |
"," |
| 6481 |
Returns internal SQL definition of the specified database object or NULL if object doesn't exist |
| 6482 |
or it is a system object without SQL definition. |
| 6483 |
|
| 6484 |
This function should not be used to analyze structure of the object by machine code. |
| 6485 |
Internal SQL representation may contain undocumented non-standard clauses |
| 6486 |
and may be different in different versions of H2. |
| 6487 |
Objects are described in the ""INFORMATION_SCHEMA"" in machine-readable way. |
| 6488 |
|
| 6489 |
Admin rights are required to execute this function. |
| 6490 |
"," |
| 6491 |
CALL DB_OBJECT_SQL('ROLE', 'MANAGER'); |
| 6492 |
CALL DB_OBJECT_SQL('TABLE', 'PUBLIC', 'MY_TABLE'); |
| 6493 |
" |
| 6494 |
|
| 6495 |
"Functions (System)","DECODE"," |
| 6496 |
@c@ DECODE(value, whenValue, thenValue [,...]) |
| 6497 |
"," |
| 6498 |
Returns the first matching value. NULL is considered to match NULL. |
| 6499 |
If no match was found, then NULL or the last parameter (if the parameter count is even) is returned. |
| 6500 |
This function is provided for Oracle compatibility, |
| 6501 |
use [CASE](https://h2database.com/html/grammar.html#case_expression) instead of it. |
| 6502 |
"," |
| 6503 |
CALL DECODE(RAND()>0.5, 0, 'Red', 1, 'Black'); |
| 6504 |
" |
| 6505 |
|
| 6506 |
"Functions (System)","DISK_SPACE_USED"," |
| 6507 |
@h2@ DISK_SPACE_USED(tableNameString) |
| 6508 |
"," |
| 6509 |
Returns the approximate amount of space used by the table specified. |
| 6510 |
Does not currently take into account indexes or LOB's. |
| 6511 |
This function may be expensive since it has to load every page in the table. |
| 6512 |
"," |
| 6513 |
CALL DISK_SPACE_USED('my_table'); |
| 6514 |
" |
| 6515 |
|
| 6516 |
"Functions (System)","SIGNAL"," |
| 6517 |
@h2@ SIGNAL(sqlStateString, messageString) |
| 6518 |
"," |
| 6519 |
Throw an SQLException with the passed SQLState and reason. |
| 6520 |
"," |
| 6521 |
CALL SIGNAL('23505', 'Duplicate user ID: ' || user_id); |
| 6522 |
" |
| 6523 |
|
| 6524 |
"Functions (System)","ESTIMATED_ENVELOPE"," |
| 6525 |
@h2@ ESTIMATED_ENVELOPE(tableNameString, columnNameString) |
| 6526 |
"," |
| 6527 |
Returns the estimated minimum bounding box that encloses all specified GEOMETRY values. |
| 6528 |
Only 2D coordinate plane is supported. |
| 6529 |
NULL values are ignored. |
| 6530 |
Column must have a spatial index. |
| 6531 |
This function is fast, but estimation may include uncommitted data (including data from other transactions), |
| 6532 |
may return approximate bounds, or be different with actual value due to other reasons. |
| 6533 |
Use with caution. |
| 6534 |
If estimation is not available this function returns NULL. |
| 6535 |
For accurate and reliable result use ESTIMATE aggregate function instead. |
| 6536 |
"," |
| 6537 |
CALL ESTIMATED_ENVELOPE('MY_TABLE', 'GEOMETRY_COLUMN'); |
| 6538 |
" |
| 6539 |
|
| 6540 |
"Functions (System)","FILE_READ"," |
| 6541 |
@h2@ FILE_READ(fileNameString [,encodingString]) |
| 6542 |
"," |
| 6543 |
Returns the contents of a file. If only one parameter is supplied, the data are |
| 6544 |
returned as a BLOB. If two parameters are used, the data is returned as a CLOB |
| 6545 |
(text). The second parameter is the character set to use, NULL meaning the |
| 6546 |
default character set for this system. |
| 6547 |
|
| 6548 |
File names and URLs are supported. |
| 6549 |
To read a stream from the classpath, use the prefix ""classpath:"". |
| 6550 |
|
| 6551 |
Admin rights are required to execute this command. |
| 6552 |
"," |
| 6553 |
SELECT LENGTH(FILE_READ('~/.h2.server.properties')) LEN; |
| 6554 |
SELECT FILE_READ('http://localhost:8182/stylesheet.css', NULL) CSS; |
| 6555 |
" |
| 6556 |
|
| 6557 |
"Functions (System)","FILE_WRITE"," |
| 6558 |
@h2@ FILE_WRITE(blobValue, fileNameString) |
| 6559 |
"," |
| 6560 |
Write the supplied parameter into a file. Return the number of bytes written. |
| 6561 |
|
| 6562 |
Write access to folder, and admin rights are required to execute this command. |
| 6563 |
"," |
| 6564 |
SELECT FILE_WRITE('Hello world', '/tmp/hello.txt')) LEN; |
| 6565 |
" |
| 6566 |
|
| 6567 |
"Functions (System)","GREATEST"," |
| 6568 |
GREATEST(aValue, bValue [,...]) |
| 6569 |
"," |
| 6570 |
Returns the largest value that is not NULL, or NULL if all values are NULL. |
| 6571 |
"," |
| 6572 |
CALL GREATEST(1, 2, 3); |
| 6573 |
" |
| 6574 |
|
| 6575 |
"Functions (System)","LEAST"," |
| 6576 |
LEAST(aValue, bValue [,...]) |
| 6577 |
"," |
| 6578 |
Returns the smallest value that is not NULL, or NULL if all values are NULL. |
| 6579 |
"," |
| 6580 |
CALL LEAST(1, 2, 3); |
| 6581 |
" |
| 6582 |
|
| 6583 |
"Functions (System)","LOCK_MODE"," |
| 6584 |
@h2@ LOCK_MODE() |
| 6585 |
"," |
| 6586 |
Returns the current lock mode. See SET LOCK_MODE. |
| 6587 |
This method returns an int. |
| 6588 |
"," |
| 6589 |
CALL LOCK_MODE(); |
| 6590 |
" |
| 6591 |
|
| 6592 |
"Functions (System)","LOCK_TIMEOUT"," |
| 6593 |
@h2@ LOCK_TIMEOUT() |
| 6594 |
"," |
| 6595 |
Returns the lock timeout of the current session (in milliseconds). |
| 6596 |
"," |
| 6597 |
LOCK_TIMEOUT() |
| 6598 |
" |
| 6599 |
|
| 6600 |
"Functions (System)","MEMORY_FREE"," |
| 6601 |
@h2@ MEMORY_FREE() |
| 6602 |
"," |
| 6603 |
Returns the free memory in KB (where 1024 bytes is a KB). |
| 6604 |
This method returns a long. |
| 6605 |
The garbage is run before returning the value. |
| 6606 |
Admin rights are required to execute this command. |
| 6607 |
"," |
| 6608 |
MEMORY_FREE() |
| 6609 |
" |
| 6610 |
|
| 6611 |
"Functions (System)","MEMORY_USED"," |
| 6612 |
@h2@ MEMORY_USED() |
| 6613 |
"," |
| 6614 |
Returns the used memory in KB (where 1024 bytes is a KB). |
| 6615 |
This method returns a long. |
| 6616 |
The garbage is run before returning the value. |
| 6617 |
Admin rights are required to execute this command. |
| 6618 |
"," |
| 6619 |
MEMORY_USED() |
| 6620 |
" |
| 6621 |
|
| 6622 |
"Functions (System)","NEXTVAL"," |
| 6623 |
@c@ NEXTVAL ( [ schemaNameString, ] sequenceString ) |
| 6624 |
"," |
| 6625 |
Increments the sequence and returns its value. |
| 6626 |
The current value of the sequence and the last identity in the current session are updated with the generated value. |
| 6627 |
Used values are never re-used, even when the transaction is rolled back. |
| 6628 |
This method exists only for compatibility, it's recommended to use the standard |
| 6629 |
[NEXT VALUE FOR sequenceName](https://h2database.com/html/grammar.html#sequence_value_expression) |
| 6630 |
instead. |
| 6631 |
If the schema name is not set, the current schema is used. |
| 6632 |
When sequence is not found, the uppercase name is also checked. |
| 6633 |
This method returns a long. |
| 6634 |
"," |
| 6635 |
NEXTVAL('TEST_SEQ') |
| 6636 |
" |
| 6637 |
|
| 6638 |
"Functions (System)","NULLIF"," |
| 6639 |
NULLIF(aValue, bValue) |
| 6640 |
"," |
| 6641 |
Returns NULL if 'a' is equal to 'b', otherwise 'a'. |
| 6642 |
"," |
| 6643 |
NULLIF(A, B) |
| 6644 |
A / NULLIF(B, 0) |
| 6645 |
" |
| 6646 |
|
| 6647 |
"Functions (System)","NVL2"," |
| 6648 |
@c@ NVL2(testValue, aValue, bValue) |
| 6649 |
"," |
| 6650 |
If the test value is null, then 'b' is returned. Otherwise, 'a' is returned. |
| 6651 |
The data type of the returned value is the data type of 'a' if this is a text type. |
| 6652 |
|
| 6653 |
This function is provided for Oracle compatibility, |
| 6654 |
use [CASE](https://h2database.com/html/grammar.html#case_expression) |
| 6655 |
or [COALESCE](https://h2database.com/html/functions.html#coalesce) instead of it. |
| 6656 |
"," |
| 6657 |
NVL2(X, 'not null', 'null') |
| 6658 |
" |
| 6659 |
|
| 6660 |
"Functions (System)","READONLY"," |
| 6661 |
@h2@ READONLY() |
| 6662 |
"," |
| 6663 |
Returns true if the database is read-only. |
| 6664 |
"," |
| 6665 |
READONLY() |
| 6666 |
" |
| 6667 |
|
| 6668 |
"Functions (System)","ROWNUM"," |
| 6669 |
@h2@ ROWNUM() |
| 6670 |
"," |
| 6671 |
Returns the number of the current row. |
| 6672 |
This method returns a long value. |
| 6673 |
It is supported for SELECT statements, as well as for DELETE and UPDATE. |
| 6674 |
The first row has the row number 1, and is calculated before ordering and grouping the result set, |
| 6675 |
but after evaluating index conditions (even when the index conditions are specified in an outer query). |
| 6676 |
Use the [ROW_NUMBER() OVER ()](https://h2database.com/html/functions-window.html#row_number) |
| 6677 |
function to get row numbers after grouping or in specified order. |
| 6678 |
"," |
| 6679 |
SELECT ROWNUM(), * FROM TEST; |
| 6680 |
SELECT ROWNUM(), * FROM (SELECT * FROM TEST ORDER BY NAME); |
| 6681 |
SELECT ID FROM (SELECT T.*, ROWNUM AS R FROM TEST T) WHERE R BETWEEN 2 AND 3; |
| 6682 |
" |
| 6683 |
|
| 6684 |
"Functions (System)","SESSION_ID"," |
| 6685 |
@h2@ SESSION_ID() |
| 6686 |
"," |
| 6687 |
Returns the unique session id number for the current database connection. |
| 6688 |
This id stays the same while the connection is open. |
| 6689 |
This method returns an int. |
| 6690 |
The database engine may re-use a session id after the connection is closed. |
| 6691 |
"," |
| 6692 |
CALL SESSION_ID() |
| 6693 |
" |
| 6694 |
|
| 6695 |
"Functions (System)","SET"," |
| 6696 |
@h2@ SET(@variableName, value) |
| 6697 |
"," |
| 6698 |
Updates a variable with the given value. |
| 6699 |
The new value is returned. |
| 6700 |
When used in a query, the value is updated in the order the rows are read. |
| 6701 |
When used in a subquery, not all rows might be read depending on the query plan. |
| 6702 |
This can be used to implement running totals / cumulative sums. |
| 6703 |
"," |
| 6704 |
SELECT X, SET(@I, COALESCE(@I, 0)+X) RUNNING_TOTAL FROM SYSTEM_RANGE(1, 10) |
| 6705 |
" |
| 6706 |
|
| 6707 |
"Functions (System)","TRANSACTION_ID"," |
| 6708 |
@h2@ TRANSACTION_ID() |
| 6709 |
"," |
| 6710 |
Returns the current transaction id for this session. |
| 6711 |
This method returns NULL if there is no uncommitted change, or if the database is not persisted. |
| 6712 |
Otherwise a value of the following form is returned: |
| 6713 |
""logFileId-position-sessionId"". |
| 6714 |
This method returns a string. |
| 6715 |
The value is unique across database restarts (values are not re-used). |
| 6716 |
"," |
| 6717 |
CALL TRANSACTION_ID() |
| 6718 |
" |
| 6719 |
|
| 6720 |
"Functions (System)","TRUNCATE_VALUE"," |
| 6721 |
@h2@ TRUNCATE_VALUE(value, precisionInt, forceBoolean) |
| 6722 |
"," |
| 6723 |
Truncate a value to the required precision. |
| 6724 |
If force flag is set to ""FALSE"" fixed precision values are not truncated. |
| 6725 |
The method returns a value with the same data type as the first parameter. |
| 6726 |
"," |
| 6727 |
CALL TRUNCATE_VALUE(X, 10, TRUE); |
| 6728 |
" |
| 6729 |
|
| 6730 |
"Functions (System)","CURRENT_PATH"," |
| 6731 |
CURRENT_PATH |
| 6732 |
"," |
| 6733 |
Returns the comma-separated list of quoted schema names where user-defined functions are searched |
| 6734 |
when they are referenced without the schema name. |
| 6735 |
"," |
| 6736 |
CURRENT_PATH |
| 6737 |
" |
| 6738 |
|
| 6739 |
"Functions (System)","CURRENT_ROLE"," |
| 6740 |
CURRENT_ROLE |
| 6741 |
"," |
| 6742 |
Returns the name of the PUBLIC role. |
| 6743 |
"," |
| 6744 |
CURRENT_ROLE |
| 6745 |
" |
| 6746 |
|
| 6747 |
"Functions (System)","CURRENT_USER"," |
| 6748 |
CURRENT_USER | SESSION_USER | SYSTEM_USER | USER |
| 6749 |
"," |
| 6750 |
Returns the name of the current user of this session. |
| 6751 |
"," |
| 6752 |
CURRENT_USER |
| 6753 |
" |
| 6754 |
|
| 6755 |
"Functions (System)","H2VERSION"," |
| 6756 |
@h2@ H2VERSION() |
| 6757 |
"," |
| 6758 |
Returns the H2 version as a String. |
| 6759 |
"," |
| 6760 |
H2VERSION() |
| 6761 |
" |
| 6762 |
|
| 6763 |
"Functions (JSON)","JSON_OBJECT"," |
| 6764 |
JSON_OBJECT( |
| 6765 |
[{{[KEY] string VALUE expression} | {string : expression}} [,...] ] |
| 6766 |
[ { NULL | ABSENT } ON NULL ] |
| 6767 |
[ { WITH | WITHOUT } UNIQUE KEYS ] |
| 6768 |
) |
| 6769 |
"," |
| 6770 |
Returns a JSON object constructed from the specified properties. |
| 6771 |
If ABSENT ON NULL is specified properties with NULL value are not included in the object. |
| 6772 |
If WITH UNIQUE KEYS is specified the constructed object is checked for uniqueness of keys, |
| 6773 |
nested objects, if any, are checked too. |
| 6774 |
"," |
| 6775 |
JSON_OBJECT('id': 100, 'name': 'Joe', 'groups': '[2,5]' FORMAT JSON); |
| 6776 |
" |
| 6777 |
|
| 6778 |
"Functions (JSON)","JSON_ARRAY"," |
| 6779 |
JSON_ARRAY( |
| 6780 |
[expression [,...]]|{(query) [FORMAT JSON]} |
| 6781 |
[ { NULL | ABSENT } ON NULL ] |
| 6782 |
) |
| 6783 |
"," |
| 6784 |
Returns a JSON array constructed from the specified values or from the specified single-column subquery. |
| 6785 |
If NULL ON NULL is specified NULL values are included in the array. |
| 6786 |
"," |
| 6787 |
JSON_ARRAY(10, 15, 20); |
| 6788 |
JSON_ARRAY(JSON_DATA_A FORMAT JSON, JSON_DATA_B FORMAT JSON); |
| 6789 |
JSON_ARRAY((SELECT J FROM PROPS) FORMAT JSON); |
| 6790 |
" |
| 6791 |
|
| 6792 |
"Functions (Table)","CSVREAD"," |
| 6793 |
@h2@ CSVREAD(fileNameString [, columnsString [, csvOptions ] ] ) |
| 6794 |
"," |
| 6795 |
Returns the result set of reading the CSV (comma separated values) file. |
| 6796 |
For each parameter, NULL means the default value should be used. |
| 6797 |
|
| 6798 |
If the column names are specified (a list of column names separated with the |
| 6799 |
fieldSeparator), those are used, otherwise (or if they are set to NULL) the first line of |
| 6800 |
the file is interpreted as the column names. |
| 6801 |
In that case, column names that contain no special characters (only letters, '_', |
| 6802 |
and digits; similar to the rule for Java identifiers) are processed is the same way as unquoted identifiers |
| 6803 |
and therefore case of characters may be changed. |
| 6804 |
Other column names are processed as quoted identifiers and case of characters is preserved. |
| 6805 |
To preserve the case of column names unconditionally use |
| 6806 |
[caseSensitiveColumnNames](https://h2database.com/html/grammar.html#csv_options) option. |
| 6807 |
|
| 6808 |
The default charset is the default value for this system, and the default field separator |
| 6809 |
is a comma. Missing unquoted values as well as data that matches nullString is |
| 6810 |
parsed as NULL. All columns are of type VARCHAR. |
| 6811 |
|
| 6812 |
The BOM (the byte-order-mark) character 0xfeff at the beginning of the file is ignored. |
| 6813 |
|
| 6814 |
This function can be used like a table: ""SELECT * FROM CSVREAD(...)"". |
| 6815 |
|
| 6816 |
Instead of a file, a URL may be used, for example |
| 6817 |
""jar:file:///c:/temp/example.zip!/org/example/nested.csv"". |
| 6818 |
To read a stream from the classpath, use the prefix ""classpath:"". |
| 6819 |
To read from HTTP, use the prefix ""http:"" (as in a browser). |
| 6820 |
|
| 6821 |
For performance reason, CSVREAD should not be used inside a join. |
| 6822 |
Instead, import the data first (possibly into a temporary table) and then use the table. |
| 6823 |
|
| 6824 |
Admin rights are required to execute this command. |
| 6825 |
"," |
| 6826 |
SELECT * FROM CSVREAD('test.csv'); |
| 6827 |
-- Read a file containing the columns ID, NAME with |
| 6828 |
SELECT * FROM CSVREAD('test2.csv', 'ID|NAME', 'charset=UTF-8 fieldSeparator=|'); |
| 6829 |
SELECT * FROM CSVREAD('data/test.csv', null, 'rowSeparator=;'); |
| 6830 |
-- Read a tab-separated file |
| 6831 |
SELECT * FROM CSVREAD('data/test.tsv', null, 'rowSeparator=' || CHAR(9)); |
| 6832 |
SELECT ""Last Name"" FROM CSVREAD('address.csv'); |
| 6833 |
SELECT ""Last Name"" FROM CSVREAD('classpath:/org/acme/data/address.csv'); |
| 6834 |
" |
| 6835 |
|
| 6836 |
"Functions (Table)","LINK_SCHEMA"," |
| 6837 |
@h2@ LINK_SCHEMA (targetSchemaString, driverString, urlString, |
| 6838 |
@h2@ userString, passwordString, sourceSchemaString) |
| 6839 |
"," |
| 6840 |
Creates table links for all tables in a schema. |
| 6841 |
If tables with the same name already exist, they are dropped first. |
| 6842 |
The target schema is created automatically if it does not yet exist. |
| 6843 |
The driver name may be empty if the driver is already loaded. |
| 6844 |
The list of tables linked is returned in the form of a result set. |
| 6845 |
Admin rights are required to execute this command. |
| 6846 |
"," |
| 6847 |
SELECT * FROM LINK_SCHEMA('TEST2', '', 'jdbc:h2:./test2', 'sa', 'sa', 'PUBLIC'); |
| 6848 |
" |
| 6849 |
|
| 6850 |
"Functions (Table)","TABLE"," |
| 6851 |
@h2@ { TABLE | TABLE_DISTINCT } |
| 6852 |
@h2@ ( { name dataTypeOrDomain = {array|rowValueExpression} } [,...] ) |
| 6853 |
"," |
| 6854 |
Returns the result set. TABLE_DISTINCT removes duplicate rows. |
| 6855 |
"," |
| 6856 |
SELECT * FROM TABLE(V INT = ARRAY[1, 2]); |
| 6857 |
SELECT * FROM TABLE(ID INT=(1, 2), NAME VARCHAR=('Hello', 'World')); |
| 6858 |
" |
| 6859 |
|
| 6860 |
"Functions (Table)","UNNEST"," |
| 6861 |
UNNEST(arrayExpression, [,...]) [WITH ORDINALITY] |
| 6862 |
"," |
| 6863 |
Returns the result set. |
| 6864 |
Number of columns is equal to number of arguments, |
| 6865 |
plus one additional column with row number if WITH ORDINALITY is specified. |
| 6866 |
Number of rows is equal to length of longest specified array. |
| 6867 |
If multiple arguments are specified and they have different length, cells with missing values will contain null values. |
| 6868 |
"," |
| 6869 |
SELECT * FROM UNNEST(ARRAY['a', 'b', 'c']); |
| 6870 |
SELECT * FROM UNNEST(JSON '[""a"", ""b"", ""c""]'); |
| 6871 |
" |
| 6872 |
|
| 6873 |
"Aggregate Functions (General)","AVG"," |
| 6874 |
AVG ( [ DISTINCT|ALL ] { numeric | interval } ) |
| 6875 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6876 |
"," |
| 6877 |
The average (mean) value. |
| 6878 |
If no rows are selected, the result is NULL. |
| 6879 |
Aggregates are only allowed in select statements. |
| 6880 |
|
| 6881 |
The data type of result is DOUBLE PRECISION for TINYINT, SMALLINT, INTEGER, and REAL arguments, |
| 6882 |
NUMERIC with additional 10 decimal digits of precision and scale for BIGINT and NUMERIC arguments; |
| 6883 |
DECFLOAT with additional 10 decimal digits of precision for DOUBLE PRECISION and DECFLOAT arguments; |
| 6884 |
INTERVAL with the same leading field precision, all additional smaller datetime units in interval qualifier, |
| 6885 |
and the maximum scale for INTERVAL arguments. |
| 6886 |
"," |
| 6887 |
AVG(X) |
| 6888 |
" |
| 6889 |
|
| 6890 |
"Aggregate Functions (General)","MAX"," |
| 6891 |
MAX(value) |
| 6892 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6893 |
"," |
| 6894 |
The highest value. |
| 6895 |
If no rows are selected, the result is NULL. |
| 6896 |
Aggregates are only allowed in select statements. |
| 6897 |
The returned value is of the same data type as the parameter. |
| 6898 |
"," |
| 6899 |
MAX(NAME) |
| 6900 |
" |
| 6901 |
|
| 6902 |
"Aggregate Functions (General)","MIN"," |
| 6903 |
MIN(value) |
| 6904 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6905 |
"," |
| 6906 |
The lowest value. |
| 6907 |
If no rows are selected, the result is NULL. |
| 6908 |
Aggregates are only allowed in select statements. |
| 6909 |
The returned value is of the same data type as the parameter. |
| 6910 |
"," |
| 6911 |
MIN(NAME) |
| 6912 |
" |
| 6913 |
|
| 6914 |
"Aggregate Functions (General)","SUM"," |
| 6915 |
SUM( [ DISTINCT|ALL ] { numeric | interval | @h2@ { boolean } } ) |
| 6916 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6917 |
"," |
| 6918 |
The sum of all values. |
| 6919 |
If no rows are selected, the result is NULL. |
| 6920 |
Aggregates are only allowed in select statements. |
| 6921 |
|
| 6922 |
The data type of result is BIGINT for BOOLEAN, TINYINT, SMALLINT, and INTEGER arguments; |
| 6923 |
NUMERIC with additional 10 decimal digits of precision for BIGINT and NUMERIC arguments; |
| 6924 |
DOUBLE PRECISION for REAL arguments, |
| 6925 |
DECFLOAT with additional 10 decimal digits of precision for DOUBLE PRECISION and DECFLOAT arguments; |
| 6926 |
INTERVAL with maximum precision and the same interval qualifier and scale for INTERVAL arguments. |
| 6927 |
"," |
| 6928 |
SUM(X) |
| 6929 |
" |
| 6930 |
|
| 6931 |
"Aggregate Functions (General)","EVERY"," |
| 6932 |
{EVERY| @c@ {BOOL_AND}}(boolean) |
| 6933 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6934 |
"," |
| 6935 |
Returns true if all expressions are true. |
| 6936 |
If no rows are selected, the result is NULL. |
| 6937 |
Aggregates are only allowed in select statements. |
| 6938 |
"," |
| 6939 |
EVERY(ID>10) |
| 6940 |
" |
| 6941 |
|
| 6942 |
"Aggregate Functions (General)","ANY"," |
| 6943 |
{ANY|SOME| @c@ {BOOL_OR}}(boolean) |
| 6944 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6945 |
"," |
| 6946 |
Returns true if any expression is true. |
| 6947 |
If no rows are selected, the result is NULL. |
| 6948 |
Aggregates are only allowed in select statements. |
| 6949 |
|
| 6950 |
Note that if ANY or SOME aggregate function is placed on the right side of comparison operation or distinct predicate |
| 6951 |
and argument of this function is a subquery additional parentheses around aggregate function are required, |
| 6952 |
otherwise it will be parsed as quantified predicate. |
| 6953 |
"," |
| 6954 |
ANY(NAME LIKE 'W%') |
| 6955 |
A = (ANY((SELECT B FROM T))) |
| 6956 |
" |
| 6957 |
|
| 6958 |
"Aggregate Functions (General)","COUNT"," |
| 6959 |
COUNT( { * | { [ DISTINCT|ALL ] expression } } ) |
| 6960 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6961 |
"," |
| 6962 |
The count of all row, or of the non-null values. |
| 6963 |
This method returns a long. |
| 6964 |
If no rows are selected, the result is 0. |
| 6965 |
Aggregates are only allowed in select statements. |
| 6966 |
"," |
| 6967 |
COUNT(*) |
| 6968 |
" |
| 6969 |
|
| 6970 |
"Aggregate Functions (General)","STDDEV_POP"," |
| 6971 |
STDDEV_POP( [ DISTINCT|ALL ] numeric ) |
| 6972 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6973 |
"," |
| 6974 |
The population standard deviation. |
| 6975 |
This method returns a double. |
| 6976 |
If no rows are selected, the result is NULL. |
| 6977 |
Aggregates are only allowed in select statements. |
| 6978 |
"," |
| 6979 |
STDDEV_POP(X) |
| 6980 |
" |
| 6981 |
|
| 6982 |
"Aggregate Functions (General)","STDDEV_SAMP"," |
| 6983 |
STDDEV_SAMP( [ DISTINCT|ALL ] numeric ) |
| 6984 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6985 |
"," |
| 6986 |
The sample standard deviation. |
| 6987 |
This method returns a double. |
| 6988 |
If less than two rows are selected, the result is NULL. |
| 6989 |
Aggregates are only allowed in select statements. |
| 6990 |
"," |
| 6991 |
STDDEV(X) |
| 6992 |
" |
| 6993 |
|
| 6994 |
"Aggregate Functions (General)","VAR_POP"," |
| 6995 |
VAR_POP( [ DISTINCT|ALL ] numeric ) |
| 6996 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 6997 |
"," |
| 6998 |
The population variance (square of the population standard deviation). |
| 6999 |
This method returns a double. |
| 7000 |
If no rows are selected, the result is NULL. |
| 7001 |
Aggregates are only allowed in select statements. |
| 7002 |
"," |
| 7003 |
VAR_POP(X) |
| 7004 |
" |
| 7005 |
|
| 7006 |
"Aggregate Functions (General)","VAR_SAMP"," |
| 7007 |
VAR_SAMP( [ DISTINCT|ALL ] numeric ) |
| 7008 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7009 |
"," |
| 7010 |
The sample variance (square of the sample standard deviation). |
| 7011 |
This method returns a double. |
| 7012 |
If less than two rows are selected, the result is NULL. |
| 7013 |
Aggregates are only allowed in select statements. |
| 7014 |
"," |
| 7015 |
VAR_SAMP(X) |
| 7016 |
" |
| 7017 |
|
| 7018 |
"Aggregate Functions (General)","ANY_VALUE"," |
| 7019 |
ANY_VALUE( @h2@ [ DISTINCT|ALL ] value ) |
| 7020 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7021 |
"," |
| 7022 |
Returns any non-NULL value from aggregated values. |
| 7023 |
If no rows are selected, the result is NULL. |
| 7024 |
This function uses the same pseudo random generator as [RAND()](https://h2database.com/html/functions.html#rand) |
| 7025 |
function. |
| 7026 |
|
| 7027 |
If DISTINCT is specified, each distinct value will be returned with approximately the same probability |
| 7028 |
as other distinct values. If it isn't specified, more frequent values will be returned with higher probability |
| 7029 |
than less frequent. |
| 7030 |
|
| 7031 |
Aggregates are only allowed in select statements. |
| 7032 |
"," |
| 7033 |
ANY_VALUE(X) |
| 7034 |
" |
| 7035 |
|
| 7036 |
"Aggregate Functions (General)","BIT_AND_AGG"," |
| 7037 |
{@h2@{BIT_AND_AGG}|@c@{BIT_AND}}@h2@(expression) |
| 7038 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7039 |
"," |
| 7040 |
The bitwise AND of all non-null values. |
| 7041 |
If no rows are selected, the result is NULL. |
| 7042 |
Aggregates are only allowed in select statements. |
| 7043 |
|
| 7044 |
For non-aggregate function see [BITAND](https://h2database.com/html/functions.html#bitand). |
| 7045 |
"," |
| 7046 |
BIT_AND_AGG(X) |
| 7047 |
" |
| 7048 |
|
| 7049 |
"Aggregate Functions (General)","BIT_OR_AGG"," |
| 7050 |
{@h2@{BIT_OR_AGG}|@c@{BIT_OR}}@h2@(expression) |
| 7051 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7052 |
"," |
| 7053 |
The bitwise OR of all non-null values. |
| 7054 |
If no rows are selected, the result is NULL. |
| 7055 |
Aggregates are only allowed in select statements. |
| 7056 |
|
| 7057 |
For non-aggregate function see [BITOR](https://h2database.com/html/functions.html#bitor). |
| 7058 |
"," |
| 7059 |
BIT_OR_AGG(X) |
| 7060 |
" |
| 7061 |
|
| 7062 |
"Aggregate Functions (General)","BIT_XOR_AGG"," |
| 7063 |
@h2@ BIT_XOR_AGG( [ DISTINCT|ALL ] expression) |
| 7064 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7065 |
"," |
| 7066 |
The bitwise XOR of all non-null values. |
| 7067 |
If no rows are selected, the result is NULL. |
| 7068 |
Aggregates are only allowed in select statements. |
| 7069 |
|
| 7070 |
For non-aggregate function see [BITXOR](https://h2database.com/html/functions.html#bitxor). |
| 7071 |
"," |
| 7072 |
BIT_XOR_AGG(X) |
| 7073 |
" |
| 7074 |
|
| 7075 |
"Aggregate Functions (General)","BIT_NAND_AGG"," |
| 7076 |
@h2@ BIT_NAND_AGG(expression) |
| 7077 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7078 |
"," |
| 7079 |
The bitwise NAND of all non-null values. |
| 7080 |
If no rows are selected, the result is NULL. |
| 7081 |
Aggregates are only allowed in select statements. |
| 7082 |
|
| 7083 |
For non-aggregate function see [BITNAND](https://h2database.com/html/functions.html#bitnand). |
| 7084 |
"," |
| 7085 |
BIT_NAND_AGG(X) |
| 7086 |
" |
| 7087 |
|
| 7088 |
"Aggregate Functions (General)","BIT_NOR_AGG"," |
| 7089 |
@h2@ BIT_NOR_AGG(expression) |
| 7090 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7091 |
"," |
| 7092 |
The bitwise NOR of all non-null values. |
| 7093 |
If no rows are selected, the result is NULL. |
| 7094 |
Aggregates are only allowed in select statements. |
| 7095 |
|
| 7096 |
For non-aggregate function see [BITNOR](https://h2database.com/html/functions.html#bitnor). |
| 7097 |
"," |
| 7098 |
BIT_NOR_AGG(X) |
| 7099 |
" |
| 7100 |
|
| 7101 |
"Aggregate Functions (General)","BIT_XNOR_AGG"," |
| 7102 |
@h2@ BIT_XNOR_AGG( [ DISTINCT|ALL ] expression) |
| 7103 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7104 |
"," |
| 7105 |
The bitwise XNOR of all non-null values. |
| 7106 |
If no rows are selected, the result is NULL. |
| 7107 |
Aggregates are only allowed in select statements. |
| 7108 |
|
| 7109 |
For non-aggregate function see [BITXNOR](https://h2database.com/html/functions.html#bitxnor). |
| 7110 |
"," |
| 7111 |
BIT_XNOR_AGG(X) |
| 7112 |
" |
| 7113 |
|
| 7114 |
"Aggregate Functions (General)","ENVELOPE"," |
| 7115 |
@h2@ ENVELOPE( value ) |
| 7116 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7117 |
"," |
| 7118 |
Returns the minimum bounding box that encloses all specified GEOMETRY values. |
| 7119 |
Only 2D coordinate plane is supported. |
| 7120 |
NULL values are ignored in the calculation. |
| 7121 |
If no rows are selected, the result is NULL. |
| 7122 |
Aggregates are only allowed in select statements. |
| 7123 |
"," |
| 7124 |
ENVELOPE(X) |
| 7125 |
" |
| 7126 |
|
| 7127 |
"Aggregate Functions (Binary Set)","COVAR_POP"," |
| 7128 |
COVAR_POP(dependentExpression, independentExpression) |
| 7129 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7130 |
"," |
| 7131 |
The population covariance. |
| 7132 |
This method returns a double. |
| 7133 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7134 |
If no rows are selected, the result is NULL. |
| 7135 |
Aggregates are only allowed in select statements. |
| 7136 |
"," |
| 7137 |
COVAR_POP(Y, X) |
| 7138 |
" |
| 7139 |
|
| 7140 |
"Aggregate Functions (Binary Set)","COVAR_SAMP"," |
| 7141 |
COVAR_SAMP(dependentExpression, independentExpression) |
| 7142 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7143 |
"," |
| 7144 |
The sample covariance. |
| 7145 |
This method returns a double. |
| 7146 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7147 |
If less than two rows are selected, the result is NULL. |
| 7148 |
Aggregates are only allowed in select statements. |
| 7149 |
"," |
| 7150 |
COVAR_SAMP(Y, X) |
| 7151 |
" |
| 7152 |
|
| 7153 |
"Aggregate Functions (Binary Set)","CORR"," |
| 7154 |
CORR(dependentExpression, independentExpression) |
| 7155 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7156 |
"," |
| 7157 |
Pearson's correlation coefficient. |
| 7158 |
This method returns a double. |
| 7159 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7160 |
If no rows are selected, the result is NULL. |
| 7161 |
Aggregates are only allowed in select statements. |
| 7162 |
"," |
| 7163 |
CORR(Y, X) |
| 7164 |
" |
| 7165 |
|
| 7166 |
"Aggregate Functions (Binary Set)","REGR_SLOPE"," |
| 7167 |
REGR_SLOPE(dependentExpression, independentExpression) |
| 7168 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7169 |
"," |
| 7170 |
The slope of the line. |
| 7171 |
This method returns a double. |
| 7172 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7173 |
If no rows are selected, the result is NULL. |
| 7174 |
Aggregates are only allowed in select statements. |
| 7175 |
"," |
| 7176 |
REGR_SLOPE(Y, X) |
| 7177 |
" |
| 7178 |
|
| 7179 |
"Aggregate Functions (Binary Set)","REGR_INTERCEPT"," |
| 7180 |
REGR_INTERCEPT(dependentExpression, independentExpression) |
| 7181 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7182 |
"," |
| 7183 |
The y-intercept of the regression line. |
| 7184 |
This method returns a double. |
| 7185 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7186 |
If no rows are selected, the result is NULL. |
| 7187 |
Aggregates are only allowed in select statements. |
| 7188 |
"," |
| 7189 |
REGR_INTERCEPT(Y, X) |
| 7190 |
" |
| 7191 |
|
| 7192 |
"Aggregate Functions (Binary Set)","REGR_COUNT"," |
| 7193 |
REGR_COUNT(dependentExpression, independentExpression) |
| 7194 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7195 |
"," |
| 7196 |
Returns the number of rows in the group. |
| 7197 |
This method returns a long. |
| 7198 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7199 |
If no rows are selected, the result is 0. |
| 7200 |
Aggregates are only allowed in select statements. |
| 7201 |
"," |
| 7202 |
REGR_COUNT(Y, X) |
| 7203 |
" |
| 7204 |
|
| 7205 |
"Aggregate Functions (Binary Set)","REGR_R2"," |
| 7206 |
REGR_R2(dependentExpression, independentExpression) |
| 7207 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7208 |
"," |
| 7209 |
The coefficient of determination. |
| 7210 |
This method returns a double. |
| 7211 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7212 |
If no rows are selected, the result is NULL. |
| 7213 |
Aggregates are only allowed in select statements. |
| 7214 |
"," |
| 7215 |
REGR_R2(Y, X) |
| 7216 |
" |
| 7217 |
|
| 7218 |
"Aggregate Functions (Binary Set)","REGR_AVGX"," |
| 7219 |
REGR_AVGX(dependentExpression, independentExpression) |
| 7220 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7221 |
"," |
| 7222 |
The average (mean) value of dependent expression. |
| 7223 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7224 |
If no rows are selected, the result is NULL. |
| 7225 |
For details about the data type see [AVG](https://h2database.com/html/functions-aggregate.html#avg). |
| 7226 |
Aggregates are only allowed in select statements. |
| 7227 |
"," |
| 7228 |
REGR_AVGX(Y, X) |
| 7229 |
" |
| 7230 |
|
| 7231 |
"Aggregate Functions (Binary Set)","REGR_AVGY"," |
| 7232 |
REGR_AVGY(dependentExpression, independentExpression) |
| 7233 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7234 |
"," |
| 7235 |
The average (mean) value of independent expression. |
| 7236 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7237 |
If no rows are selected, the result is NULL. |
| 7238 |
For details about the data type see [AVG](https://h2database.com/html/functions-aggregate.html#avg). |
| 7239 |
Aggregates are only allowed in select statements. |
| 7240 |
"," |
| 7241 |
REGR_AVGY(Y, X) |
| 7242 |
" |
| 7243 |
|
| 7244 |
"Aggregate Functions (Binary Set)","REGR_SXX"," |
| 7245 |
REGR_SXX(dependentExpression, independentExpression) |
| 7246 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7247 |
"," |
| 7248 |
The the sum of squares of independent expression. |
| 7249 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7250 |
If no rows are selected, the result is NULL. |
| 7251 |
Aggregates are only allowed in select statements. |
| 7252 |
"," |
| 7253 |
REGR_SXX(Y, X) |
| 7254 |
" |
| 7255 |
|
| 7256 |
"Aggregate Functions (Binary Set)","REGR_SYY"," |
| 7257 |
REGR_SYY(dependentExpression, independentExpression) |
| 7258 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7259 |
"," |
| 7260 |
The the sum of squares of dependent expression. |
| 7261 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7262 |
If no rows are selected, the result is NULL. |
| 7263 |
Aggregates are only allowed in select statements. |
| 7264 |
"," |
| 7265 |
REGR_SYY(Y, X) |
| 7266 |
" |
| 7267 |
|
| 7268 |
"Aggregate Functions (Binary Set)","REGR_SXY"," |
| 7269 |
REGR_SXY(dependentExpression, independentExpression) |
| 7270 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7271 |
"," |
| 7272 |
The the sum of products independent expression times dependent expression. |
| 7273 |
Rows in which either argument is NULL are ignored in the calculation. |
| 7274 |
If no rows are selected, the result is NULL. |
| 7275 |
Aggregates are only allowed in select statements. |
| 7276 |
"," |
| 7277 |
REGR_SXY(Y, X) |
| 7278 |
" |
| 7279 |
|
| 7280 |
"Aggregate Functions (Ordered)","LISTAGG"," |
| 7281 |
LISTAGG ( [ DISTINCT|ALL ] string [, separatorString] |
| 7282 |
[ ON OVERFLOW { ERROR |
| 7283 |
| TRUNCATE [ filterString ] { WITH | WITHOUT } COUNT } ] ) |
| 7284 |
withinGroupSpecification |
| 7285 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7286 |
"," |
| 7287 |
Concatenates strings with a separator. |
| 7288 |
The default separator is a ',' (without space). |
| 7289 |
This method returns a string. |
| 7290 |
NULL values are ignored in the calculation, COALESCE can be used to replace them. |
| 7291 |
If no rows are selected, the result is NULL. |
| 7292 |
|
| 7293 |
If ""ON OVERFLOW TRUNCATE"" is specified, values that don't fit into returned string are truncated |
| 7294 |
and replaced with filter string placeholder ('...' by default) and count of truncated elements in parentheses. |
| 7295 |
If ""WITHOUT COUNT"" is specified, count of truncated elements is not appended. |
| 7296 |
|
| 7297 |
Aggregates are only allowed in select statements. |
| 7298 |
"," |
| 7299 |
LISTAGG(NAME, ', ') WITHIN GROUP (ORDER BY ID) |
| 7300 |
LISTAGG(COALESCE(NAME, 'null'), ', ') WITHIN GROUP (ORDER BY ID) |
| 7301 |
LISTAGG(ID, ', ') WITHIN GROUP (ORDER BY ID) OVER (ORDER BY ID) |
| 7302 |
LISTAGG(ID, ';' ON OVERFLOW TRUNCATE 'etc' WITHOUT COUNT) WITHIN GROUP (ORDER BY ID) |
| 7303 |
" |
| 7304 |
|
| 7305 |
"Aggregate Functions (Ordered)","ARRAY_AGG"," |
| 7306 |
ARRAY_AGG ( @h2@ [ DISTINCT|ALL ] value |
| 7307 |
[ ORDER BY sortSpecificationList ] ) |
| 7308 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7309 |
"," |
| 7310 |
Aggregate the value into an array. |
| 7311 |
This method returns an array. |
| 7312 |
NULL values are included in the array, FILTER clause can be used to exclude them. |
| 7313 |
If no rows are selected, the result is NULL. |
| 7314 |
If ORDER BY is not specified order of values is not determined. |
| 7315 |
When this aggregate is used with OVER clause that contains ORDER BY subclause |
| 7316 |
it does not enforce exact order of values. |
| 7317 |
This aggregate needs additional own ORDER BY clause to make it deterministic. |
| 7318 |
Aggregates are only allowed in select statements. |
| 7319 |
"," |
| 7320 |
ARRAY_AGG(NAME ORDER BY ID) |
| 7321 |
ARRAY_AGG(NAME ORDER BY ID) FILTER (WHERE NAME IS NOT NULL) |
| 7322 |
ARRAY_AGG(ID ORDER BY ID) OVER (ORDER BY ID) |
| 7323 |
" |
| 7324 |
|
| 7325 |
"Aggregate Functions (Hypothetical Set)","RANK aggregate"," |
| 7326 |
RANK(value [,...]) |
| 7327 |
withinGroupSpecification |
| 7328 |
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7329 |
"," |
| 7330 |
Returns the rank of the hypothetical row in specified collection of rows. |
| 7331 |
The rank of a row is the number of rows that precede this row plus 1. |
| 7332 |
If two or more rows have the same values in ORDER BY columns, these rows get the same rank from the first row with the same values. |
| 7333 |
It means that gaps in ranks are possible. |
| 7334 |
|
| 7335 |
See [RANK](https://h2database.com/html/functions-window.html#rank) for a window function with the same name. |
| 7336 |
"," |
| 7337 |
SELECT RANK(5) WITHIN GROUP (ORDER BY V) FROM TEST; |
| 7338 |
" |
| 7339 |
|
| 7340 |
"Aggregate Functions (Hypothetical Set)","DENSE_RANK aggregate"," |
| 7341 |
DENSE_RANK(value [,...]) |
| 7342 |
withinGroupSpecification |
| 7343 |
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7344 |
"," |
| 7345 |
Returns the dense rank of the hypothetical row in specified collection of rows. |
| 7346 |
The rank of a row is the number of groups of rows with the same values in ORDER BY columns that precede group with this row plus 1. |
| 7347 |
If two or more rows have the same values in ORDER BY columns, these rows get the same rank. |
| 7348 |
Gaps in ranks are not possible. |
| 7349 |
|
| 7350 |
See [DENSE_RANK](https://h2database.com/html/functions-window.html#dense_rank) for a window function with the same name. |
| 7351 |
"," |
| 7352 |
SELECT DENSE_RANK(5) WITHIN GROUP (ORDER BY V) FROM TEST; |
| 7353 |
" |
| 7354 |
|
| 7355 |
"Aggregate Functions (Hypothetical Set)","PERCENT_RANK aggregate"," |
| 7356 |
PERCENT_RANK(value [,...]) |
| 7357 |
withinGroupSpecification |
| 7358 |
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7359 |
"," |
| 7360 |
Returns the relative rank of the hypothetical row in specified collection of rows. |
| 7361 |
The relative rank is calculated as (RANK - 1) / (NR - 1), |
| 7362 |
where RANK is a rank of the row and NR is a total number of rows in the collection including hypothetical row. |
| 7363 |
|
| 7364 |
See [PERCENT_RANK](https://h2database.com/html/functions-window.html#percent_rank) for a window function with the same name. |
| 7365 |
"," |
| 7366 |
SELECT PERCENT_RANK(5) WITHIN GROUP (ORDER BY V) FROM TEST; |
| 7367 |
" |
| 7368 |
|
| 7369 |
"Aggregate Functions (Hypothetical Set)","CUME_DIST aggregate"," |
| 7370 |
CUME_DIST(value [,...]) |
| 7371 |
withinGroupSpecification |
| 7372 |
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7373 |
"," |
| 7374 |
Returns the relative rank of the hypothetical row in specified collection of rows. |
| 7375 |
The relative rank is calculated as NP / NR |
| 7376 |
where NP is a number of rows that precede the current row or have the same values in ORDER BY columns |
| 7377 |
and NR is a total number of rows in the collection including hypothetical row. |
| 7378 |
|
| 7379 |
See [CUME_DIST](https://h2database.com/html/functions-window.html#cume_dist) for a window function with the same name. |
| 7380 |
"," |
| 7381 |
SELECT CUME_DIST(5) WITHIN GROUP (ORDER BY V) FROM TEST; |
| 7382 |
" |
| 7383 |
|
| 7384 |
"Aggregate Functions (Inverse Distribution)","PERCENTILE_CONT"," |
| 7385 |
PERCENTILE_CONT(numeric) WITHIN GROUP (ORDER BY sortSpecification) |
| 7386 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7387 |
"," |
| 7388 |
Return percentile of values from the group with interpolation. |
| 7389 |
Interpolation is only supported for numeric, date-time, and interval data types. |
| 7390 |
Argument must be between 0 and 1 inclusive. |
| 7391 |
Argument must be the same for all rows in the same group. |
| 7392 |
If argument is NULL, the result is NULL. |
| 7393 |
NULL values are ignored in the calculation. |
| 7394 |
If no rows are selected, the result is NULL. |
| 7395 |
Aggregates are only allowed in select statements. |
| 7396 |
"," |
| 7397 |
PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY V) |
| 7398 |
" |
| 7399 |
|
| 7400 |
"Aggregate Functions (Inverse Distribution)","PERCENTILE_DISC"," |
| 7401 |
PERCENTILE_DISC(numeric) WITHIN GROUP (ORDER BY sortSpecification) |
| 7402 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7403 |
"," |
| 7404 |
Return percentile of values from the group. |
| 7405 |
Interpolation is not performed. |
| 7406 |
Argument must be between 0 and 1 inclusive. |
| 7407 |
Argument must be the same for all rows in the same group. |
| 7408 |
If argument is NULL, the result is NULL. |
| 7409 |
NULL values are ignored in the calculation. |
| 7410 |
If no rows are selected, the result is NULL. |
| 7411 |
Aggregates are only allowed in select statements. |
| 7412 |
"," |
| 7413 |
PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY V) |
| 7414 |
" |
| 7415 |
|
| 7416 |
"Aggregate Functions (Inverse Distribution)","MEDIAN"," |
| 7417 |
@h2@ MEDIAN( [ DISTINCT|ALL ] value ) |
| 7418 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7419 |
"," |
| 7420 |
The value separating the higher half of a values from the lower half. |
| 7421 |
Returns the middle value or an interpolated value between two middle values if number of values is even. |
| 7422 |
Interpolation is only supported for numeric, date-time, and interval data types. |
| 7423 |
NULL values are ignored in the calculation. |
| 7424 |
If no rows are selected, the result is NULL. |
| 7425 |
Aggregates are only allowed in select statements. |
| 7426 |
"," |
| 7427 |
MEDIAN(X) |
| 7428 |
" |
| 7429 |
|
| 7430 |
"Aggregate Functions (Inverse Distribution)","MODE"," |
| 7431 |
@h2@ { MODE() WITHIN GROUP (ORDER BY sortSpecification) } |
| 7432 |
| @c@ { MODE( value [ ORDER BY sortSpecification ] ) } |
| 7433 |
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification] |
| 7434 |
"," |
| 7435 |
Returns the value that occurs with the greatest frequency. |
| 7436 |
If there are multiple values with the same frequency only one value will be returned. |
| 7437 |
In this situation value will be chosen based on optional ORDER BY clause |
| 7438 |
that should specify exactly the same expression as argument of this function. |
| 7439 |
Use ascending order to get smallest value or descending order to get largest value |
| 7440 |
from multiple values with the same frequency. |
| 7441 |
If this clause is not specified the exact chosen value is not determined in this situation. |
| 7442 |
NULL values are ignored in the calculation. |
| 7443 |
If no rows are selected, the result is NULL. |
| 7444 |
Aggregates are only allowed in select statements. |
| 7445 |
"," |
| 7446 |
MODE() WITHIN GROUP (ORDER BY X) |
| 7447 |
" |
| 7448 |
|
| 7449 |
"Aggregate Functions (JSON)","JSON_OBJECTAGG"," |
| 7450 |
JSON_OBJECTAGG( |
| 7451 |
{[KEY] string VALUE value} | {string : value} |
| 7452 |
[ { NULL | ABSENT } ON NULL ] |
| 7453 |
[ { WITH | WITHOUT } UNIQUE KEYS ] |
| 7454 |
) |
| 7455 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7456 |
"," |
| 7457 |
Aggregates the keys with values into a JSON object. |
| 7458 |
If ABSENT ON NULL is specified properties with NULL value are not included in the object. |
| 7459 |
If WITH UNIQUE KEYS is specified the constructed object is checked for uniqueness of keys, |
| 7460 |
nested objects, if any, are checked too. |
| 7461 |
If no values are selected, the result is SQL NULL value. |
| 7462 |
"," |
| 7463 |
JSON_OBJECTAGG(NAME: VAL); |
| 7464 |
JSON_OBJECTAGG(KEY NAME VALUE VAL); |
| 7465 |
" |
| 7466 |
|
| 7467 |
"Aggregate Functions (JSON)","JSON_ARRAYAGG"," |
| 7468 |
JSON_ARRAYAGG( @h2@ [ DISTINCT|ALL ] expression |
| 7469 |
[ ORDER BY sortSpecificationList ] |
| 7470 |
[ { NULL | ABSENT } ON NULL ] ) |
| 7471 |
[FILTER (WHERE expression)] [OVER windowNameOrSpecification] |
| 7472 |
"," |
| 7473 |
Aggregates the values into a JSON array. |
| 7474 |
If NULL ON NULL is specified NULL values are included in the array. |
| 7475 |
If no values are selected, the result is SQL NULL value. |
| 7476 |
"," |
| 7477 |
JSON_ARRAYAGG(NUMBER) |
| 7478 |
" |
| 7479 |
|
| 7480 |
"Window Functions (Row Number)","ROW_NUMBER"," |
| 7481 |
ROW_NUMBER() OVER windowNameOrSpecification |
| 7482 |
"," |
| 7483 |
Returns the number of the current row starting with 1. |
| 7484 |
Window frame clause is not allowed for this function. |
| 7485 |
|
| 7486 |
Window functions in H2 may require a lot of memory for large queries. |
| 7487 |
"," |
| 7488 |
SELECT ROW_NUMBER() OVER (), * FROM TEST; |
| 7489 |
SELECT ROW_NUMBER() OVER (ORDER BY ID), * FROM TEST; |
| 7490 |
SELECT ROW_NUMBER() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST; |
| 7491 |
" |
| 7492 |
|
| 7493 |
"Window Functions (Rank)","RANK"," |
| 7494 |
RANK() OVER windowNameOrSpecification |
| 7495 |
"," |
| 7496 |
Returns the rank of the current row. |
| 7497 |
The rank of a row is the number of rows that precede this row plus 1. |
| 7498 |
If two or more rows have the same values in ORDER BY columns, these rows get the same rank from the first row with the same values. |
| 7499 |
It means that gaps in ranks are possible. |
| 7500 |
This function requires window order clause. |
| 7501 |
Window frame clause is not allowed for this function. |
| 7502 |
|
| 7503 |
Window functions in H2 may require a lot of memory for large queries. |
| 7504 |
|
| 7505 |
See [RANK aggregate](https://h2database.com/html/functions-aggregate.html#rank_aggregate) for a hypothetical set function with the same name. |
| 7506 |
"," |
| 7507 |
SELECT RANK() OVER (ORDER BY ID), * FROM TEST; |
| 7508 |
SELECT RANK() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST; |
| 7509 |
" |
| 7510 |
|
| 7511 |
"Window Functions (Rank)","DENSE_RANK"," |
| 7512 |
DENSE_RANK() OVER windowNameOrSpecification |
| 7513 |
"," |
| 7514 |
Returns the dense rank of the current row. |
| 7515 |
The rank of a row is the number of groups of rows with the same values in ORDER BY columns that precede group with this row plus 1. |
| 7516 |
If two or more rows have the same values in ORDER BY columns, these rows get the same rank. |
| 7517 |
Gaps in ranks are not possible. |
| 7518 |
This function requires window order clause. |
| 7519 |
Window frame clause is not allowed for this function. |
| 7520 |
|
| 7521 |
Window functions in H2 may require a lot of memory for large queries. |
| 7522 |
|
| 7523 |
See [DENSE_RANK aggregate](https://h2database.com/html/functions-aggregate.html#dense_rank_aggregate) for a hypothetical set function with the same name. |
| 7524 |
"," |
| 7525 |
SELECT DENSE_RANK() OVER (ORDER BY ID), * FROM TEST; |
| 7526 |
SELECT DENSE_RANK() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST; |
| 7527 |
" |
| 7528 |
|
| 7529 |
"Window Functions (Rank)","PERCENT_RANK"," |
| 7530 |
PERCENT_RANK() OVER windowNameOrSpecification |
| 7531 |
"," |
| 7532 |
Returns the relative rank of the current row. |
| 7533 |
The relative rank is calculated as (RANK - 1) / (NR - 1), |
| 7534 |
where RANK is a rank of the row and NR is a number of rows in window partition with this row. |
| 7535 |
Note that result is always 0 if window order clause is not specified. |
| 7536 |
Window frame clause is not allowed for this function. |
| 7537 |
|
| 7538 |
Window functions in H2 may require a lot of memory for large queries. |
| 7539 |
|
| 7540 |
See [PERCENT_RANK aggregate](https://h2database.com/html/functions-aggregate.html#percent_rank_aggregate) for a hypothetical set function with the same name. |
| 7541 |
"," |
| 7542 |
SELECT PERCENT_RANK() OVER (ORDER BY ID), * FROM TEST; |
| 7543 |
SELECT PERCENT_RANK() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST; |
| 7544 |
" |
| 7545 |
|
| 7546 |
"Window Functions (Rank)","CUME_DIST"," |
| 7547 |
CUME_DIST() OVER windowNameOrSpecification |
| 7548 |
"," |
| 7549 |
Returns the relative rank of the current row. |
| 7550 |
The relative rank is calculated as NP / NR |
| 7551 |
where NP is a number of rows that precede the current row or have the same values in ORDER BY columns |
| 7552 |
and NR is a number of rows in window partition with this row. |
| 7553 |
Note that result is always 1 if window order clause is not specified. |
| 7554 |
Window frame clause is not allowed for this function. |
| 7555 |
|
| 7556 |
Window functions in H2 may require a lot of memory for large queries. |
| 7557 |
|
| 7558 |
See [CUME_DIST aggregate](https://h2database.com/html/functions-aggregate.html#cume_dist_aggregate) for a hypothetical set function with the same name. |
| 7559 |
"," |
| 7560 |
SELECT CUME_DIST() OVER (ORDER BY ID), * FROM TEST; |
| 7561 |
SELECT CUME_DIST() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST; |
| 7562 |
" |
| 7563 |
|
| 7564 |
"Window Functions (Lead or Lag)","LEAD"," |
| 7565 |
LEAD(value [, offsetInt [, defaultValue]]) [{RESPECT|IGNORE} NULLS] |
| 7566 |
OVER windowNameOrSpecification |
| 7567 |
"," |
| 7568 |
Returns the value in a next row with specified offset relative to the current row. |
| 7569 |
Offset must be non-negative. |
| 7570 |
If IGNORE NULLS is specified rows with null values in selected expression are skipped. |
| 7571 |
If number of considered rows is less than specified relative number this function returns NULL |
| 7572 |
or the specified default value, if any. |
| 7573 |
If offset is 0 the value from the current row is returned unconditionally. |
| 7574 |
This function requires window order clause. |
| 7575 |
Window frame clause is not allowed for this function. |
| 7576 |
|
| 7577 |
Window functions in H2 may require a lot of memory for large queries. |
| 7578 |
"," |
| 7579 |
SELECT LEAD(X) OVER (ORDER BY ID), * FROM TEST; |
| 7580 |
SELECT LEAD(X, 2, 0) IGNORE NULLS OVER ( |
| 7581 |
PARTITION BY CATEGORY ORDER BY ID |
| 7582 |
), * FROM TEST; |
| 7583 |
" |
| 7584 |
|
| 7585 |
"Window Functions (Lead or Lag)","LAG"," |
| 7586 |
LAG(value [, offsetInt [, defaultValue]]) [{RESPECT|IGNORE} NULLS] |
| 7587 |
OVER windowNameOrSpecification |
| 7588 |
"," |
| 7589 |
Returns the value in a previous row with specified offset relative to the current row. |
| 7590 |
Offset must be non-negative. |
| 7591 |
If IGNORE NULLS is specified rows with null values in selected expression are skipped. |
| 7592 |
If number of considered rows is less than specified relative number this function returns NULL |
| 7593 |
or the specified default value, if any. |
| 7594 |
If offset is 0 the value from the current row is returned unconditionally. |
| 7595 |
This function requires window order clause. |
| 7596 |
Window frame clause is not allowed for this function. |
| 7597 |
|
| 7598 |
Window functions in H2 may require a lot of memory for large queries. |
| 7599 |
"," |
| 7600 |
SELECT LAG(X) OVER (ORDER BY ID), * FROM TEST; |
| 7601 |
SELECT LAG(X, 2, 0) IGNORE NULLS OVER ( |
| 7602 |
PARTITION BY CATEGORY ORDER BY ID |
| 7603 |
), * FROM TEST; |
| 7604 |
" |
| 7605 |
|
| 7606 |
"Window Functions (Nth Value)","FIRST_VALUE"," |
| 7607 |
FIRST_VALUE(value) [{RESPECT|IGNORE} NULLS] |
| 7608 |
OVER windowNameOrSpecification |
| 7609 |
"," |
| 7610 |
Returns the first value in a window. |
| 7611 |
If IGNORE NULLS is specified null values are skipped and the function returns first non-null value, if any. |
| 7612 |
|
| 7613 |
Window functions in H2 may require a lot of memory for large queries. |
| 7614 |
"," |
| 7615 |
SELECT FIRST_VALUE(X) OVER (ORDER BY ID), * FROM TEST; |
| 7616 |
SELECT FIRST_VALUE(X) IGNORE NULLS OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST; |
| 7617 |
" |
| 7618 |
|
| 7619 |
"Window Functions (Nth Value)","LAST_VALUE"," |
| 7620 |
LAST_VALUE(value) [{RESPECT|IGNORE} NULLS] |
| 7621 |
OVER windowNameOrSpecification |
| 7622 |
"," |
| 7623 |
Returns the last value in a window. |
| 7624 |
If IGNORE NULLS is specified null values are skipped and the function returns last non-null value before them, if any; |
| 7625 |
if there is no non-null value it returns NULL. |
| 7626 |
Note that the last value is actually a value in the current group of rows |
| 7627 |
if window order clause is specified and window frame clause is not specified. |
| 7628 |
|
| 7629 |
Window functions in H2 may require a lot of memory for large queries. |
| 7630 |
"," |
| 7631 |
SELECT LAST_VALUE(X) OVER (ORDER BY ID), * FROM TEST; |
| 7632 |
SELECT LAST_VALUE(X) IGNORE NULLS OVER ( |
| 7633 |
PARTITION BY CATEGORY ORDER BY ID |
| 7634 |
RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING |
| 7635 |
), * FROM TEST; |
| 7636 |
" |
| 7637 |
|
| 7638 |
"Window Functions (Nth Value)","NTH_VALUE"," |
| 7639 |
NTH_VALUE(value, nInt) [FROM {FIRST|LAST}] [{RESPECT|IGNORE} NULLS] |
| 7640 |
OVER windowNameOrSpecification |
| 7641 |
"," |
| 7642 |
Returns the value in a row with a specified relative number in a window. |
| 7643 |
Relative row number must be positive. |
| 7644 |
If FROM LAST is specified rows a counted backwards from the last row. |
| 7645 |
If IGNORE NULLS is specified rows with null values in selected expression are skipped. |
| 7646 |
If number of considered rows is less than specified relative number this function returns NULL. |
| 7647 |
Note that the last row is actually a last row in the current group of rows |
| 7648 |
if window order clause is specified and window frame clause is not specified. |
| 7649 |
|
| 7650 |
Window functions in H2 may require a lot of memory for large queries. |
| 7651 |
"," |
| 7652 |
SELECT NTH_VALUE(X) OVER (ORDER BY ID), * FROM TEST; |
| 7653 |
SELECT NTH_VALUE(X) IGNORE NULLS OVER ( |
| 7654 |
PARTITION BY CATEGORY ORDER BY ID |
| 7655 |
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING |
| 7656 |
), * FROM TEST; |
| 7657 |
" |
| 7658 |
|
| 7659 |
"Window Functions (Other)","NTILE"," |
| 7660 |
NTILE(long) OVER windowNameOrSpecification |
| 7661 |
"," |
| 7662 |
Distributes the rows into a specified number of groups. |
| 7663 |
Number of groups should be a positive long value. |
| 7664 |
NTILE returns the 1-based number of the group to which the current row belongs. |
| 7665 |
First groups will have more rows if number of rows is not divisible by number of groups. |
| 7666 |
For example, if 5 rows are distributed into 2 groups this function returns 1 for the first 3 row and 2 for the last 2 rows. |
| 7667 |
This function requires window order clause. |
| 7668 |
Window frame clause is not allowed for this function. |
| 7669 |
|
| 7670 |
Window functions in H2 may require a lot of memory for large queries. |
| 7671 |
"," |
| 7672 |
SELECT NTILE(10) OVER (ORDER BY ID), * FROM TEST; |
| 7673 |
SELECT NTILE(5) OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST; |
| 7674 |
" |
| 7675 |
|
| 7676 |
"Window Functions (Other)","RATIO_TO_REPORT"," |
| 7677 |
@h2@ RATIO_TO_REPORT(value) |
| 7678 |
@h2@ OVER windowNameOrSpecification |
| 7679 |
"," |
| 7680 |
Returns the ratio of a value to the sum of all values. |
| 7681 |
If argument is NULL or sum of all values is 0, then the value of function is NULL. |
| 7682 |
Window ordering and window frame clauses are not allowed for this function. |
| 7683 |
|
| 7684 |
Window functions in H2 may require a lot of memory for large queries. |
| 7685 |
"," |
| 7686 |
SELECT X, RATIO_TO_REPORT(X) OVER (PARTITION BY CATEGORY), CATEGORY FROM TEST; |
| 7687 |
" |
| 7688 |
|
| 7689 |
"System Tables","Information Schema"," |
| 7690 |
INFORMATION_SCHEMA |
| 7691 |
"," |
| 7692 |
To get the list of system tables, execute the statement SELECT * FROM |
| 7693 |
INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'INFORMATION_SCHEMA' |
| 7694 |
"," |
| 7695 |
" |
| 7696 |
|
| 7697 |
"System Tables","Range Table"," |
| 7698 |
@h2@ SYSTEM_RANGE(start, end [, step]) |
| 7699 |
"," |
| 7700 |
Contains all values from start to end (this is a dynamic table). |
| 7701 |
"," |
| 7702 |
SYSTEM_RANGE(0, 100) |
| 7703 |
" |