Questo contenuto non è disponibile nella lingua selezionata.
Chapter 12. BNF for SQL Grammar
12.1. Reserved Keywords Copia collegamentoCollegamento copiato negli appunti!
12.2. Non-Reserved Keywords Copia collegamentoCollegamento copiato negli appunti!
12.3. Reserved Keywords For Future Use Copia collegamentoCollegamento copiato negli appunti!
ALLOCATE | ARE | ASENSITIVE |
ASYMETRIC | AUTHORIZATION | BINARY |
CALLED | CASCADED | CHARACTER |
CHECK | CLOSE | COLLATE |
CONNECT | CORRESPONDING | CRITERIA |
CURRENT_USER | CURSOR | CYCLE |
DATALINK | DEALLOCATE | DEC |
DEREF | DESCRIBE | DETERMINISTIC |
DISCONNECT | DLNEWCOPY | DLPREVIOUSCOPY |
DLURLCOMPLETE | DLURLCOMPLETEONLY | DLURLCOMPLETEWRITE |
DLURLPATH | DLURLPATHONLY | DLURLPATHWRITE |
DLURLSCHEME | DLURLSERVER | DLVALUE |
DYNAMIC | ELEMENT | EXTERNAL |
FREE | GET | HAS |
HOLD | IDENTITY | INDICATOR |
INPUT | INSENSITIVE | INT |
INTERVAL | ISOLATION | LARGE |
LOCALTIME | LOCALTIMESTAMP | MATCH |
MEMBER | METHOD | MODIFIES |
MODULE | MULTISET | NATIONAL |
NATURAL | NCHAR | NCLOB |
NEW | NUMERIC | OLD |
OPEN | OUTPUT | OVERLAPS |
PRECISION | PREPARE | READS |
RECURSIVE | REFERENCING | RELEASE |
ROLLBACK | SAVEPOINT | SCROLL |
SEARCH | SENSITIVE | SESSION_USER |
SPECIFIC | SPECIFICTYPE | SQL |
START | STATIC | SUBMULTILIST |
SYMETRIC | SYSTEM | SYSTEM_USER |
TIMEZONE_HOUR | TIMEZONE_MINUTE | TRANSLATION |
TREAT | VALUE | VARYING |
WHENEVER | WINDOW | XMLBINARY |
XMLDOCUMENT | XMLITERATE | XMLVALIDATE |
12.4. Tokens Copia collegamentoCollegamento copiato negli appunti!
12.5. Production Cross-Reference Copia collegamentoCollegamento copiato negli appunti!
12.6. Productions Copia collegamentoCollegamento copiato negli appunti!
12.6.1. string ::= Copia collegamentoCollegamento copiato negli appunti!
A string literal value. Use '' to escape ' in the string.
Example:
'a string'
'a string'
'it''s a string'
'it''s a string'
12.6.2. non-reserved identifier ::= Copia collegamentoCollegamento copiato negli appunti!
Allows non-reserved keywords to be parsed as identifiers
Example: SELECT COUNT FROM …
12.6.3. basicNonReserved ::= Copia collegamentoCollegamento copiato negli appunti!
- INSTEAD
- VIEW
- ENABLED
- DISABLED
- KEY
- TEXTAGG
- COUNT
- COUNT_BIG
- ROW_NUMBER
- RANK
- DENSE_RANK
- SUM
- AVG
- MIN
- MAX
- EVERY
- STDDEV_POP
- STDDEV_SAMP
- VAR_SAMP
- VAR_POP
- DOCUMENT
- CONTENT
- TRIM
- EMPTY
- ORDINALITY
- PATH
- FIRST
- LAST
- NEXT
- SUBSTRING
- EXTRACT
- TO_CHARS
- TO_BYTES
- TIMESTAMPADD
- TIMESTAMPDIFF
- QUERYSTRING
- NAMESPACE
- RESULT
- ACCESSPATTERN
- AUTO_INCREMENT
- WELLFORMED
- SQL_TSI_FRAC_SECOND
- SQL_TSI_SECOND
- SQL_TSI_MINUTE
- SQL_TSI_HOUR
- SQL_TSI_DAY
- SQL_TSI_WEEK
- SQL_TSI_MONTH
- SQL_TSI_QUARTER
- SQL_TSI_YEAR
- TEXTTABLE
- ARRAYTABLE
- JSONTABLE
- SELECTOR
- SKIP
- WIDTH
- PASSING
- NAME
- ENCODING
- COLUMNS
- DELIMITER
- QUOTE
- HEADER
- NULLS
- OBJECTTABLE
- VERSION
- INCLUDING
- EXCLUDING
- XMLDECLARATION
- VARIADIC
- RAISE
- CHAIN
- JSONARRAY_AGG
- JSONOBJECT
- PRESERVE
- UPSERT
- AFTER
- TYPE
- TRANSLATOR
- JAAS
- CONDITION
- MASK
- ACCESS
- CONTROL
- NONE
- DATA
- DATABASE
- PRIVILEGES
- ROLE
- SCHEMA
- USE
- REPOSITORY
- RENAME
- DOMAIN
- USAGE
- POSITION
- CURRENT
- UNBOUNDED
- PRECEDING
- FOLLOWING
- LISTAGG
- EXPLAIN
- ANALYZE
- TEXT
- FORMAT
- YAML
- EPOCH
- QUARTER
- POLICY
12.6.4. Unqualified identifier ::= Copia collegamentoCollegamento copiato negli appunti!
Unqualified name of a single entity.
Example:
"tbl"
"tbl"
12.6.5. identifier ::= Copia collegamentoCollegamento copiato negli appunti!
Partial or full name of a single entity.
Example:
tbl.col
tbl.col
"tbl"."col"
"tbl"."col"
12.6.6. create trigger ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE TRIGGER ( <identifier> )? ON <identifier> ( ( INSTEAD OF ) | AFTER ) ( INSERT | UPDATE | DELETE ) AS <for each row trigger action>
Creates a trigger action on the given target.
Example:
CREATE TRIGGER ON vw INSTEAD OF INSERT AS FOR EACH ROW BEGIN ATOMIC ... END
CREATE TRIGGER ON vw INSTEAD OF INSERT AS FOR EACH ROW BEGIN ATOMIC ... END
12.6.7. alter ::= Copia collegamentoCollegamento copiato negli appunti!
- ALTER ( ( VIEW <identifier> AS <query expression> ) | ( PROCEDURE <identifier> AS <statement> ) | ( TRIGGER ( <identifier> )? ON <identifier> ( ( INSTEAD OF ) | AFTER ) ( INSERT | UPDATE | DELETE ) ( ( AS <for each row trigger action> ) | ENABLED | DISABLED ) ) )
Alter the given target.
Example:
ALTER VIEW vw AS SELECT col FROM tbl
ALTER VIEW vw AS SELECT col FROM tbl
12.6.8. for each row trigger action ::= Copia collegamentoCollegamento copiato negli appunti!
Defines an action to perform on each row.
Example:
FOR EACH ROW BEGIN ATOMIC ... END
FOR EACH ROW BEGIN ATOMIC ... END
12.6.9. explain ::= Copia collegamentoCollegamento copiato negli appunti!
- EXPLAIN ( <lparen> <explain option> ( <comma> <explain option> )* <rparen> )? <directly executable statement>
Returns the query plan for the statement
Example: EXPLAIN select 1
12.6.10. explain option ::= Copia collegamentoCollegamento copiato negli appunti!
Option for the explain statement
Example: FORMAT YAML
12.6.11. directly executable statement ::= Copia collegamentoCollegamento copiato negli appunti!
A statement that can be executed at runtime.
Example:
SELECT * FROM tbl
SELECT * FROM tbl
12.6.12. drop table ::= Copia collegamentoCollegamento copiato negli appunti!
Drop the given table.
Example:
DROP TABLE #temp
DROP TABLE #temp
12.6.13. create temporary table ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE ( LOCAL )? TEMPORARY TABLE <Unqualified identifier> <lparen> <temporary table element> ( <comma> <temporary table element> )* ( <comma> PRIMARY KEY <column list> )? <rparen> ( ON COMMIT PRESERVE ROWS )?
Creates a temporary table.
Example:
CREATE LOCAL TEMPORARY TABLE tmp (col integer)
CREATE LOCAL TEMPORARY TABLE tmp (col integer)
12.6.14. temporary table element ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( <basic data type> | SERIAL ) ( NOT NULL )?
Defines a temporary table column.
Example:
col string NOT NULL
col string NOT NULL
12.6.15. raise error statement ::= Copia collegamentoCollegamento copiato negli appunti!
Raises an error with the given message.
Example:
ERROR 'something went wrong'
ERROR 'something went wrong'
12.6.16. raise statement ::= Copia collegamentoCollegamento copiato negli appunti!
- RAISE ( SQLWARNING )? <exception reference>
Raises an error or warning with the given message.
Example:
RAISE SQLEXCEPTION 'something went wrong'
RAISE SQLEXCEPTION 'something went wrong'
12.6.17. exception reference ::= Copia collegamentoCollegamento copiato negli appunti!
a reference to an exception
Example:
SQLEXCEPTION 'something went wrong' SQLSTATE '00X', 2
SQLEXCEPTION 'something went wrong' SQLSTATE '00X', 2
12.6.18. sql exception ::= Copia collegamentoCollegamento copiato negli appunti!
- SQLEXCEPTION <common value expression> ( SQLSTATE <common value expression> ( <comma> <common value expression> )? )? ( CHAIN <exception reference> )?
creates a sql exception or warning with the specified message, state, and code
Example:
SQLEXCEPTION 'something went wrong' SQLSTATE '00X', 2
SQLEXCEPTION 'something went wrong' SQLSTATE '00X', 2
12.6.19. statement ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( <identifier> <colon> )? ( <loop statement> | <while statement> | <compound statement> ) )
- <if statement> | <delimited statement>
A procedure statement.
Example:
IF (x = 5) BEGIN ... END
IF (x = 5) BEGIN ... END
12.6.20. delimited statement ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <assignment statement> | <data statement> | <raise error statement> | <raise statement> | <declare statement> | <branching statement> | <return statement> ) <semicolon>
A procedure statement terminated by ;.
Example:
SELECT * FROM tbl;
SELECT * FROM tbl;
12.6.21. compound statement ::= Copia collegamentoCollegamento copiato negli appunti!
A procedure statement block contained in BEGIN END.
Example:
BEGIN NOT ATOMIC ... END
BEGIN NOT ATOMIC ... END
12.6.22. branching statement ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( BREAK | CONTINUE ) ( <identifier> )? )
- ( LEAVE <identifier> )
A procedure branching control statement, which typically specifies a label to return control to.
Example:
BREAK x
BREAK x
12.6.23. return statement ::= Copia collegamentoCollegamento copiato negli appunti!
- RETURN ( <expression> )?
A return statement.
Example:
RETURN 1
RETURN 1
12.6.24. while statement ::= Copia collegamentoCollegamento copiato negli appunti!
A procedure while statement that executes until its condition is false.
Example:
WHILE (var) BEGIN ... END
WHILE (var) BEGIN ... END
12.6.25. loop statement ::= Copia collegamentoCollegamento copiato negli appunti!
- LOOP ON <lparen> <query expression> <rparen> AS <identifier> <statement>
A procedure loop statement that executes over the given cursor.
Example:
LOOP ON (SELECT * FROM tbl) AS x BEGIN ... END
LOOP ON (SELECT * FROM tbl) AS x BEGIN ... END
12.6.26. if statement ::= Copia collegamentoCollegamento copiato negli appunti!
A procedure loop statement that executes over the given cursor.
Example:
IF (boolVal) BEGIN variables.x = 1 END ELSE BEGIN variables.x = 2 END
IF (boolVal) BEGIN variables.x = 1 END ELSE BEGIN variables.x = 2 END
12.6.27. declare statement ::= Copia collegamentoCollegamento copiato negli appunti!
- DECLARE ( <data type> | EXCEPTION ) <identifier> ( <eq> <assignment statement operand> )?
A procedure declaration statement that creates a variable and optionally assigns a value.
Example:
DECLARE STRING x = 'a'
DECLARE STRING x = 'a'
12.6.28. assignment statement ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> <eq> ( <assignment statement operand> | ( <call statement> ( ( WITH | WITHOUT ) RETURN )? ) )
Assigns a variable a value in a procedure.
Example:
x = 'b'
x = 'b'
12.6.29. assignment statement operand ::= Copia collegamentoCollegamento copiato negli appunti!
A value or command that can be used in an assignment. {note}All assignments except for expression are deprecated.{note}
12.6.30. data statement ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <directly executable statement> | <dynamic data statement> ) ( ( WITH | WITHOUT ) RETURN )?
A procedure statement that executes a SQL statement. An update statement can have its update count accessed via the ROWCOUNT variable.
12.6.31. dynamic data statement ::= Copia collegamentoCollegamento copiato negli appunti!
- ( EXECUTE | EXEC ) ( STRING | IMMEDIATE )? <expression> ( AS <typed element list> ( INTO <identifier> )? )? ( USING <set clause list> )? ( UPDATE ( <unsigned integer> | <star> ) )?
A procedure statement that can execute arbitrary sql.
Example:
EXECUTE IMMEDIATE 'SELECT * FROM tbl' AS x STRING INTO #temp
EXECUTE IMMEDIATE 'SELECT * FROM tbl' AS x STRING INTO #temp
12.6.32. set clause list ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> <eq> <expression> ( <comma> <identifier> <eq> <expression> )*
A list of value assignments.
Example:
col1 = 'x', col2 = 'y' ...
col1 = 'x', col2 = 'y' ...
12.6.33. typed element list ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> <basic data type> ( <comma> <identifier> <basic data type> )*
A list of typed elements.
Example:
col1 string, col2 integer ...
col1 string, col2 integer ...
12.6.34. callable statement ::= Copia collegamentoCollegamento copiato negli appunti!
- <lbrace> ( <qmark> <eq> )? CALL <identifier> ( <lparen> ( <named parameter list> | ( <expression list> )? ) <rparen> )? <rbrace> ( <option clause> )?
A callable statement defined using JDBC escape syntax.
Example:
{? = CALL proc}
{? = CALL proc}
12.6.35. call statement ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( EXEC | EXECUTE | CALL ) <identifier> <lparen> ( <named parameter list> | ( <expression list> )? ) <rparen> ) ( <option clause> )?
Executes the procedure with the given parameters.
Example:
CALL proc('a', 1)
CALL proc('a', 1)
12.6.36. named parameter list ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <identifier> <eq> ( <gt> )? <expression> ( <comma> <identifier> <eq> ( <gt> )? <expression> )* )
A list of named parameters.
Example:
param1 => 'x', param2 => 1
param1 => 'x', param2 => 1
12.6.37. insert statement ::= Copia collegamentoCollegamento copiato negli appunti!
- ( INSERT | MERGE | UPSERT ) INTO <identifier> ( <column list> )? <query expression> ( <option clause> )?
Inserts values into the given target.
Example:
INSERT INTO tbl (col1, col2) VALUES ('a', 1)
INSERT INTO tbl (col1, col2) VALUES ('a', 1)
12.6.38. expression list ::= Copia collegamentoCollegamento copiato negli appunti!
- <expression> ( <comma> <expression> )*
A list of expressions.
Example:
col1, 'a', ...
col1, 'a', ...
12.6.39. update statement ::= Copia collegamentoCollegamento copiato negli appunti!
- UPDATE <identifier> ( ( AS )? <identifier> )? SET <set clause list> ( <where clause> )? ( <option clause> )?
Update values in the given target.
Example:
UPDATE tbl SET (col1 = 'a') WHERE col2 = 1
UPDATE tbl SET (col1 = 'a') WHERE col2 = 1
12.6.40. delete statement ::= Copia collegamentoCollegamento copiato negli appunti!
- DELETE FROM <identifier> ( ( AS )? <identifier> )? ( <where clause> )? ( <option clause> )?
Delete rows from the given target.
Example:
DELETE FROM tbl WHERE col2 = 1
DELETE FROM tbl WHERE col2 = 1
12.6.41. query expression ::= Copia collegamentoCollegamento copiato negli appunti!
- ( WITH <with list element> ( <comma> <with list element> )* )? <query expression body>
A declarative query for data.
Example:
SELECT * FROM tbl WHERE col2 = 1
SELECT * FROM tbl WHERE col2 = 1
12.6.42. with list element ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( <column list> )? AS <lparen> <query expression> <rparen>
A query expression for use in the enclosing query.
Example:
X (Y, Z) AS (SELECT 1, 2)
X (Y, Z) AS (SELECT 1, 2)
12.6.43. query expression body ::= Copia collegamentoCollegamento copiato negli appunti!
- <query term> ( ( UNION | EXCEPT ) ( ALL | DISTINCT )? <query term> )* ( <order by clause> )? ( <limit clause> )? ( <option clause> )?
The body of a query expression, which can optionally be ordered and limited.
Example:
SELECT * FROM tbl ORDER BY col1 LIMIT 1
SELECT * FROM tbl ORDER BY col1 LIMIT 1
12.6.44. query term ::= Copia collegamentoCollegamento copiato negli appunti!
- <query primary> ( INTERSECT ( ALL | DISTINCT )? <query primary> )*
Used to establish INTERSECT precedence.
Example:
SELECT * FROM tbl
SELECT * FROM tbl
SELECT * FROM tbl1 INTERSECT SELECT * FROM tbl2
SELECT * FROM tbl1 INTERSECT SELECT * FROM tbl2
12.6.45. query primary ::= Copia collegamentoCollegamento copiato negli appunti!
- <query>
- ( VALUES <lparen> <expression list> <rparen> ( <comma> <lparen> <expression list> <rparen> )* )
- ( TABLE <identifier> )
- ( <lparen> <query expression body> <rparen> )
A declarative source of rows.
Example:
TABLE tbl
TABLE tbl
SELECT * FROM tbl1
SELECT * FROM tbl1
12.6.46. query ::= Copia collegamentoCollegamento copiato negli appunti!
- <select clause> ( <into clause> )? ( <from clause> ( <where clause> )? ( <group by clause> )? ( <having clause> )? )?
A SELECT query.
Example:
SELECT col1, max(col2) FROM tbl GROUP BY col1
SELECT col1, max(col2) FROM tbl GROUP BY col1
12.6.47. into clause ::= Copia collegamentoCollegamento copiato negli appunti!
Used to direct the query into a table. {note}This is deprecated. Use INSERT INTO with a query expression instead.{note}
Example:
INTO tbl
INTO tbl
12.6.48. select clause ::= Copia collegamentoCollegamento copiato negli appunti!
- SELECT ( ALL | DISTINCT )? ( <star> | ( <select sublist> ( <comma> <select sublist> )* ) )
The columns returned by a query. Can optionally be distinct.
Example:
SELECT *
SELECT *
SELECT DISTINCT a, b, c
SELECT DISTINCT a, b, c
12.6.49. select sublist ::= Copia collegamentoCollegamento copiato negli appunti!
An element in the select clause
Example:
tbl.*
tbl.*
tbl.col AS x
tbl.col AS x
12.6.50. select derived column ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <expression> ( ( AS )? <identifier> )? )
A select clause item that selects a single column. {note}This is slightly different than a derived column in that the AS keyword is optional.{note}
Example:
tbl.col AS x
tbl.col AS x
12.6.51. derived column ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <expression> ( AS <identifier> )? )
An optionally named expression.
Example:
tbl.col AS x
tbl.col AS x
12.6.52. all in group ::= Copia collegamentoCollegamento copiato negli appunti!
A select sublist that can select all columns from the given group.
Example:
tbl.*
tbl.*
12.6.53. ordered aggregate function ::= Copia collegamentoCollegamento copiato negli appunti!
- ( XMLAGG | ARRAY_AGG | JSONARRAY_AGG ) <lparen> <expression> ( <order by clause> )? <rparen>
An aggregate function that can optionally be ordered.
Example:
XMLAGG(col1) ORDER BY col2
XMLAGG(col1) ORDER BY col2
ARRAY_AGG(col1)
ARRAY_AGG(col1)
12.6.54. text aggreate function ::= Copia collegamentoCollegamento copiato negli appunti!
- TEXTAGG <lparen> ( FOR )? <derived column> ( <comma> <derived column> )* ( DELIMITER <character> )? ( ( QUOTE <character> ) | ( NO QUOTE ) )? ( HEADER )? ( ENCODING <identifier> )? ( <order by clause> )? <rparen>
An aggregate function for creating separated value clobs.
Example:
TEXTAGG (col1 as t1, col2 as t2 DELIMITER ',' HEADER)
TEXTAGG (col1 as t1, col2 as t2 DELIMITER ',' HEADER)
12.6.55. standard aggregate function ::= Copia collegamentoCollegamento copiato negli appunti!
A standard aggregate function.
Example:
COUNT(*)
COUNT(*)
12.6.56. analytic aggregate function ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ROW_NUMBER | RANK | DENSE_RANK | PERCENT_RANK | CUME_DIST ) <lparen> <rparen>
An analytic aggregate function.
Example:
ROW_NUMBER()
ROW_NUMBER()
12.6.57. filter clause ::= Copia collegamentoCollegamento copiato negli appunti!
- FILTER <lparen> WHERE <boolean primary> <rparen>
An aggregate filter clause applied prior to accumulating the value.
Example:
FILTER (WHERE col1='a')
FILTER (WHERE col1='a')
12.6.58. from clause ::= Copia collegamentoCollegamento copiato negli appunti!
- FROM ( <table reference> ( <comma> <table reference> )* )
A query from clause containing a list of table references.
Example:
FROM a, b
FROM a, b
FROM a right outer join b, c, d join e".</p>
FROM a right outer join b, c, d join e".</p>
12.6.59. table reference ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <escaped join> <joined table> <rbrace> )
- <joined table>
An optionally escaped joined table.
Example:
a
a
a inner join b
a inner join b
12.6.60. joined table ::= Copia collegamentoCollegamento copiato negli appunti!
- <table primary> ( <cross join> | <qualified table> )*
A table or join.
Example:
a
a
a inner join b
a inner join b
12.6.61. cross join ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( CROSS | UNION ) JOIN <table primary> )
A cross join.
Example:
a CROSS JOIN b
a CROSS JOIN b
12.6.62. qualified table ::= Copia collegamentoCollegamento copiato negli appunti!
An INNER or OUTER join.
Example:
a inner join b
a inner join b
12.6.63. table primary ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <text table> | <array table> | <json table> | <xml table> | <object table> | <table name> | <table subquery> | ( <lparen> <joined table> <rparen> ) ) ( ( MAKEDEP <make dep options> ) | MAKENOTDEP )? ( ( MAKEIND <make dep options> ) )?
A single source of rows.
Example:
a
a
12.6.64. make dep options ::= Copia collegamentoCollegamento copiato negli appunti!
options for the make dep hint
Example:
(min:10000)
(min:10000)
12.6.65. xml serialize ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLSERIALIZE <lparen> ( DOCUMENT | CONTENT )? <expression> ( AS ( STRING | VARCHAR | CLOB | VARBINARY | BLOB ) )? ( ENCODING <identifier> )? ( VERSION <string> )? ( ( INCLUDING | EXCLUDING ) XMLDECLARATION )? <rparen>
Serializes an XML value.
Example:
XMLSERIALIZE(col1 AS CLOB)
XMLSERIALIZE(col1 AS CLOB)
12.6.66. array table ::= Copia collegamentoCollegamento copiato negli appunti!
- ARRAYTABLE <lparen> ( ROW | ROWS )? <value expression primary> COLUMNS <typed element list> <rparen> ( AS )? <identifier>
The ARRAYTABLE table function creates tabular results from arrays. It can be used as a nested table reference.
Example:
ARRAYTABLE (col1 COLUMNS x STRING) AS y
ARRAYTABLE (col1 COLUMNS x STRING) AS y
12.6.67. json table ::= Copia collegamentoCollegamento copiato negli appunti!
- JSONTABLE <lparen> <value expression primary> <comma> <string> ( <comma> ( TRUE | FALSE ) )? COLUMNS <json table column> ( <comma> <json table column> )* <rparen> ( AS )? <identifier>
The JSONTABLE table function creates tabular results from JSON. It can be used as a nested table reference.
Example:
JSONTABLE (col1, '$..book', false COLUMNS x STRING) AS y
JSONTABLE (col1, '$..book', false COLUMNS x STRING) AS y
12.6.68. json table column ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( ( FOR ORDINALITY ) | ( <basic data type> ( PATH <string> )? ) )
json table column.
Example:
col FOR ORDINALITY
col FOR ORDINALITY
12.6.69. text table ::= Copia collegamentoCollegamento copiato negli appunti!
- TEXTTABLE <lparen> <common value expression> ( SELECTOR <string> )? COLUMNS <text table column> ( <comma> <text table column> )* ( ( NO ROW DELIMITER ) | ( ROW DELIMITER <character> ) )? ( DELIMITER <character> )? ( ( ESCAPE <character> ) | ( QUOTE <character> ) )? ( HEADER ( <unsigned integer> )? )? ( SKIP <unsigned integer> )? ( NO TRIM )? <rparen> ( AS )? <identifier>
The TEXTTABLE table function creates tabular results from text. It can be used as a nested table reference.
Example:
TEXTTABLE (file COLUMNS x STRING) AS y
TEXTTABLE (file COLUMNS x STRING) AS y
12.6.70. text table column ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( ( FOR ORDINALITY ) | ( ( HEADER <string> )? <basic data type> ( WIDTH <unsigned integer> ( NO TRIM )? )? ( SELECTOR <string> <unsigned integer> )? ) )
A text table column.
Example:
x INTEGER WIDTH 6
x INTEGER WIDTH 6
12.6.71. xml query ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLEXISTS <lparen> ( <xml namespaces> <comma> )? <string> ( PASSING <derived column> ( <comma> <derived column> )* )? <rparen>
Executes an XQuery to return an XML result.
Example:
XMLQUERY('<a>...</a>' PASSING doc)
XMLQUERY('<a>...</a>' PASSING doc)
12.6.72. xml query ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLQUERY <lparen> ( <xml namespaces> <comma> )? <string> ( PASSING <derived column> ( <comma> <derived column> )* )? ( ( NULL | EMPTY ) ON EMPTY )? <rparen>
Executes an XQuery to return an XML result.
Example:
XMLQUERY('<a>...</a>' PASSING doc)
XMLQUERY('<a>...</a>' PASSING doc)
12.6.73. object table ::= Copia collegamentoCollegamento copiato negli appunti!
- OBJECTTABLE <lparen> ( LANGUAGE <string> )? <string> ( PASSING <derived column> ( <comma> <derived column> )* )? COLUMNS <object table column> ( <comma> <object table column> )* <rparen> ( AS )? <identifier>
Returns table results by processing a script.
Example:
OBJECTTABLE('z' PASSING val AS z COLUMNS col OBJECT 'teiid_row') AS X
OBJECTTABLE('z' PASSING val AS z COLUMNS col OBJECT 'teiid_row') AS X
12.6.74. object table column ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> <basic data type> <string> ( DEFAULT <expression> )?
object table column.
Example:
y integer 'teiid_row_number'
y integer 'teiid_row_number'
12.6.75. xml table ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLTABLE <lparen> ( <xml namespaces> <comma> )? <string> ( PASSING <derived column> ( <comma> <derived column> )* )? ( COLUMNS <xml table column> ( <comma> <xml table column> )* )? <rparen> ( AS )? <identifier>
Returns table results by processing an XQuery.
Example:
XMLTABLE('/a/b' PASSING doc COLUMNS col XML PATH '.') AS X
XMLTABLE('/a/b' PASSING doc COLUMNS col XML PATH '.') AS X
12.6.76. xml table column ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( ( FOR ORDINALITY ) | ( <basic data type> ( DEFAULT <expression> )? ( PATH <string> )? ) )
XML table column.
Example:
y FOR ORDINALITY
y FOR ORDINALITY
12.6.77. unsigned integer ::= Copia collegamentoCollegamento copiato negli appunti!
An unsigned interger value.
Example:
12345
12345
12.6.78. table subquery ::= Copia collegamentoCollegamento copiato negli appunti!
- ( TABLE | LATERAL )? <lparen> ( <query expression> | <call statement> ) <rparen> ( AS )? <identifier>
A table defined by a subquery.
Example:
(SELECT * FROM tbl) AS x
(SELECT * FROM tbl) AS x
12.6.79. table name ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <identifier> ( ( AS )? <identifier> )? )
A table named in the FROM clause.
Example:
tbl AS x
tbl AS x
12.6.80. where clause ::= Copia collegamentoCollegamento copiato negli appunti!
Specifies a search condition
Example:
WHERE x = 'a'
WHERE x = 'a'
12.6.81. condition ::= Copia collegamentoCollegamento copiato negli appunti!
A boolean expression.
12.6.82. boolean value expression ::= Copia collegamentoCollegamento copiato negli appunti!
- <boolean term> ( OR <boolean term> )*
An optionally ORed boolean expression.
12.6.83. boolean term ::= Copia collegamentoCollegamento copiato negli appunti!
- <boolean factor> ( AND <boolean factor> )*
An optional ANDed boolean factor.
12.6.84. boolean factor ::= Copia collegamentoCollegamento copiato negli appunti!
- ( NOT )? <boolean primary>
A boolean factor.
Example:
NOT x = 'a'
NOT x = 'a'
12.6.85. boolean primary ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <common value expression> ( <between predicate> | <match predicate> | <like regex predicate> | <in predicate> | <is null predicate> | <quantified comparison predicate> | <comparison predicate> | <is distinct> )? )
- <exists predicate>
- <xml query>
A boolean predicate or simple expression.
Example:
col LIKE 'a%'
col LIKE 'a%'
12.6.86. comparison operator ::= Copia collegamentoCollegamento copiato negli appunti!
A comparison operator.
Example:
=
=
12.6.87. is distinct ::= Copia collegamentoCollegamento copiato negli appunti!
- IS ( NOT )? DISTINCT FROM <common value expression>
Is Distinct Right Hand Side
Example:
IS DISTINCT FROM expression
IS DISTINCT FROM expression
12.6.88. comparison predicate ::= Copia collegamentoCollegamento copiato negli appunti!
A value comparison.
Example:
= 'a'
= 'a'
12.6.89. subquery ::= Copia collegamentoCollegamento copiato negli appunti!
- <lparen> ( <query expression> | <call statement> ) <rparen>
A subquery.
Example:
(SELECT * FROM tbl)
(SELECT * FROM tbl)
12.6.90. quantified comparison predicate ::= Copia collegamentoCollegamento copiato negli appunti!
- <comparison operator> ( ANY | SOME | ALL ) ( <subquery> | ( <lparen> <expression> <rparen> ) )
A subquery comparison.
Example:
= ANY (SELECT col FROM tbl)
= ANY (SELECT col FROM tbl)
12.6.91. match predicate ::= Copia collegamentoCollegamento copiato negli appunti!
Matches based upon a pattern.
Example:
LIKE 'a_'
LIKE 'a_'
12.6.92. like regex predicate ::= Copia collegamentoCollegamento copiato negli appunti!
- ( NOT )? LIKE_REGEX <common value expression>
A regular expression match.
Example:
LIKE_REGEX 'a.*b'
LIKE_REGEX 'a.*b'
12.6.93. character ::= Copia collegamentoCollegamento copiato negli appunti!
- <string>
A single character.
Example:
'a'
'a'
12.6.94. between predicate ::= Copia collegamentoCollegamento copiato negli appunti!
A comparison between two values.
Example:
BETWEEN 1 AND 5
BETWEEN 1 AND 5
12.6.95. is null predicate ::= Copia collegamentoCollegamento copiato negli appunti!
A null test.
Example:
IS NOT NULL
IS NOT NULL
12.6.96. in predicate ::= Copia collegamentoCollegamento copiato negli appunti!
- ( NOT )? IN ( <subquery> | ( <lparen> <common value expression> ( <comma> <common value expression> )* <rparen> ) )
A comparison with multiple values.
Example:
IN (1, 5)
IN (1, 5)
12.6.97. exists predicate ::= Copia collegamentoCollegamento copiato negli appunti!
A test if rows exist.
Example:
EXISTS (SELECT col FROM tbl)
EXISTS (SELECT col FROM tbl)
12.6.98. group by clause ::= Copia collegamentoCollegamento copiato negli appunti!
- GROUP BY ( ROLLUP <lparen> <expression list> <rparen> | <expression list> )
Defines the grouping columns
Example:
GROUP BY col1, col2
GROUP BY col1, col2
12.6.99. having clause ::= Copia collegamentoCollegamento copiato negli appunti!
Search condition applied after grouping.
Example:
HAVING max(col1) = 5
HAVING max(col1) = 5
12.6.100. order by clause ::= Copia collegamentoCollegamento copiato negli appunti!
- ORDER BY <sort specification> ( <comma> <sort specification> )*
Specifices row ordering.
Example:
ORDER BY x, y DESC
ORDER BY x, y DESC
12.6.101. sort specification ::= Copia collegamentoCollegamento copiato negli appunti!
Defines how to sort on a particular expression
Example:
col1 NULLS FIRST
col1 NULLS FIRST
12.6.102. sort key ::= Copia collegamentoCollegamento copiato negli appunti!
A sort expression.
Example:
col1
col1
12.6.103. integer parameter ::= Copia collegamentoCollegamento copiato negli appunti!
A literal integer or parameter reference to an integer.
Example:
?
?
12.6.104. limit clause ::= Copia collegamentoCollegamento copiato negli appunti!
- ( LIMIT <integer parameter> ( ( <comma> <integer parameter> ) | ( OFFSET <integer parameter> ) )? )
- ( OFFSET <integer parameter> ( ROW | ROWS ) ( <fetch clause> )? )
- <fetch clause>
Limits and/or offsets the resultant rows.
Example:
LIMIT 2
LIMIT 2
12.6.105. fetch clause ::= Copia collegamentoCollegamento copiato negli appunti!
ANSI limit.
Example:
FETCH FIRST 1 ROWS ONLY
FETCH FIRST 1 ROWS ONLY
12.6.106. option clause ::= Copia collegamentoCollegamento copiato negli appunti!
- OPTION ( MAKEDEP <identifier> <make dep options> ( <comma> <identifier> <make dep options> )* | MAKEIND <identifier> <make dep options> ( <comma> <identifier> <make dep options> )* | MAKENOTDEP <identifier> ( <comma> <identifier> )* | NOCACHE ( <identifier> ( <comma> <identifier> )* )? )*
Specifies query options.
Example:
OPTION MAKEDEP tbl
OPTION MAKEDEP tbl
12.6.107. expression ::= Copia collegamentoCollegamento copiato negli appunti!
A value.
Example:
col1
col1
12.6.108. common value expression ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <numeric value expression> ( ( <double_amp_op> | <concat_op> ) <numeric value expression> )* )
Establishes the precedence of concat.
Example:
'a' || 'b'
'a' || 'b'
12.6.109. numeric value expression ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <term> ( <plus or minus> <term> )* )
Example:
1 + 2
1 + 2
12.6.110. plus or minus ::= Copia collegamentoCollegamento copiato negli appunti!
The + or - operator.
Example:
+
+
12.6.111. term ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <value expression primary> ( <star or slash> <value expression primary> )* )
A numeric term
Example:
1 * 2
1 * 2
12.6.112. star or slash ::= Copia collegamentoCollegamento copiato negli appunti!
The * or / operator.
Example:
/
/
12.6.113. value expression primary ::= Copia collegamentoCollegamento copiato negli appunti!
- <non numeric literal>
- ( <plus or minus> )? ( <unsigned numeric literal> | ( <unsigned value expression primary> ( <lsbrace> <numeric value expression> <rsbrace> )* ) )
A simple value expression.
Example:
+col1
+col1
12.6.114. parameter reference ::= Copia collegamentoCollegamento copiato negli appunti!
- <qmark>
- ( <dollar> <unsigned integer> )
A parameter reference to be bound later.
Example:
?
?
12.6.115. unescapedFunction ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( <text aggreate function> | <standard aggregate function> | <ordered aggregate function> ) ( <filter clause> )? ( <window specification> )? ) | ( <analytic aggregate function> ( <filter clause> )? <window specification> ) | ( <function> ( <window specification> )? )
- ( XMLCAST <lparen> <expression> AS <data type> <rparen> )
12.6.116. nested expression ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <lparen> ( <expression> ( <comma> <expression> )* )? ( <comma> )? <rparen> )
An expression nested in parens
Example:
(1)
(1)
12.6.117. unsigned value expression primary ::= Copia collegamentoCollegamento copiato negli appunti!
An unsigned simple value expression.
Example:
col1
col1
12.6.118. ARRAY expression constructor ::= Copia collegamentoCollegamento copiato negli appunti!
- ARRAY ( ( <lsbrace> ( <expression> ( <comma> <expression> )* )? <rsbrace> ) | ( <lparen> <query expression> <rparen> ) )
Creates and array of the given expressions.
Example:
ARRAY[1,2]
ARRAY[1,2]
12.6.119. window specification ::= Copia collegamentoCollegamento copiato negli appunti!
- OVER <lparen> ( PARTITION BY <expression list> )? ( <order by clause> )? ( <window frame> )? <rparen>
The window specification for an analytical or windowed aggregate function.
Example:
OVER (PARTION BY col1)
OVER (PARTION BY col1)
12.6.120. window frame ::= Copia collegamentoCollegamento copiato negli appunti!
- ( RANGE | ROWS ) ( ( BETWEEN <window frame bound> AND <window frame bound> ) | <window frame bound> )
Defines the mode, start, and optionally end of the window frame
Example:
RANGE UNBOUNDED PRECEDING
RANGE UNBOUNDED PRECEDING
12.6.121. window frame bound ::= Copia collegamentoCollegamento copiato negli appunti!
Defines the start or end of a window frame
Example:
CURRENT ROW
CURRENT ROW
12.6.122. case expression ::= Copia collegamentoCollegamento copiato negli appunti!
- CASE <expression> ( WHEN <expression> THEN <expression> )+ ( ELSE <expression> )? END
If/then/else chain using a common search predicand.
Example:
CASE col1 WHEN 'a' THEN 1 ELSE 2
CASE col1 WHEN 'a' THEN 1 ELSE 2
12.6.123. searched case expression ::= Copia collegamentoCollegamento copiato negli appunti!
- CASE ( WHEN <condition> THEN <expression> )+ ( ELSE <expression> )? END
If/then/else chain using multiple search conditions.
Example:
CASE WHEN x = 'a' THEN 1 WHEN y = 'b' THEN 2
CASE WHEN x = 'a' THEN 1 WHEN y = 'b' THEN 2
12.6.124. function ::= Copia collegamentoCollegamento copiato negli appunti!
- ( CONVERT <lparen> <expression> <comma> <data type> <rparen> )
- ( CAST <lparen> <expression> AS <data type> <rparen> )
- ( SUBSTRING <lparen> <expression> ( ( FROM <expression> ( FOR <expression> )? ) | ( <comma> <expression list> ) ) <rparen> )
- ( EXTRACT <lparen> ( YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | QUARTER | EPOCH ) FROM <expression> <rparen> )
- ( TRIM <lparen> ( ( ( ( LEADING | TRAILING | BOTH ) ( <expression> )? ) | <expression> ) FROM )? <expression> <rparen> )
- ( ( TO_CHARS | TO_BYTES ) <lparen> <expression> <comma> <string> ( <comma> <expression> )? <rparen> )
- ( ( TIMESTAMPADD | TIMESTAMPDIFF ) <lparen> <time interval> <comma> <expression> <comma> <expression> <rparen> )
- <querystring function>
- ( ( LEFT | RIGHT | CHAR | USER | YEAR | MONTH | HOUR | MINUTE | SECOND | XMLCONCAT | XMLCOMMENT | XMLTEXT ) <lparen> ( <expression list> )? <rparen> )
- ( ( TRANSLATE | INSERT ) <lparen> ( <expression list> )? <rparen> )
- <xml parse>
- <xml element>
- ( XMLPI <lparen> ( ( NAME )? <identifier> ) ( <comma> <expression> )? <rparen> )
- <xml forest>
- <json object>
- <xml serialize>
- <xml query>
- ( POSITION <lparen> <common value expression> IN <common value expression> <rparen> )
- ( LISTAGG <lparen> <expression> ( <comma> <string> )? <rparen> WITHIN GROUP <lparen> <order by clause> <rparen> )
- ( <identifier> <lparen> ( ALL | DISTINCT )? ( <expression list> )? ( <order by clause> )? <rparen> ( <filter clause> )? )
- ( CURRENT_DATE ( <lparen> <rparen> )? )
- ( ( CURRENT_TIMESTAMP | CURRENT_TIME ) ( <lparen> <unsigned integer> <rparen> )? )
Calls a scalar function.
Example:
func('1', col1)
func('1', col1)
12.6.125. xml parse ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLPARSE <lparen> ( DOCUMENT | CONTENT ) <expression> ( WELLFORMED )? <rparen>
Parses the given value as XML.
Example:
XMLPARSE(DOCUMENT doc WELLFORMED)
XMLPARSE(DOCUMENT doc WELLFORMED)
12.6.126. querystring function ::= Copia collegamentoCollegamento copiato negli appunti!
- QUERYSTRING <lparen> <expression> ( <comma> <derived column> )* <rparen>
Produces a URL query string from the given arguments.
Example:
QUERYSTRING('path', col1 AS opt, col2 AS val)
QUERYSTRING('path', col1 AS opt, col2 AS val)
12.6.127. xml element ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLELEMENT <lparen> ( ( NAME )? <identifier> ) ( <comma> <xml namespaces> )? ( <comma> <xml attributes> )? ( <comma> <expression> )* <rparen>
Creates an XML element.
Example:
XMLELEMENT(NAME "root", child)
XMLELEMENT(NAME "root", child)
12.6.128. xml attributes ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLATTRIBUTES <lparen> <derived column> ( <comma> <derived column> )* <rparen>
Creates attributes for the containing element.
Example:
XMLATTRIBUTES(col1 AS attr1, col2 AS attr2)
XMLATTRIBUTES(col1 AS attr1, col2 AS attr2)
12.6.129. json object ::= Copia collegamentoCollegamento copiato negli appunti!
Produces a JSON object containing name value pairs.
Example:
JSONOBJECT(col1 AS val1, col2 AS val2)
JSONOBJECT(col1 AS val1, col2 AS val2)
12.6.130. derived column list ::= Copia collegamentoCollegamento copiato negli appunti!
- <derived column> ( <comma> <derived column> )*
a list of name value pairs
Example:
col1 AS val1, col2 AS val2
col1 AS val1, col2 AS val2
12.6.131. xml forest ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLFOREST <lparen> ( <xml namespaces> <comma> )? <derived column list> <rparen>
Produces an element for each derived column.
Example:
XMLFOREST(col1 AS ELEM1, col2 AS ELEM2)
XMLFOREST(col1 AS ELEM1, col2 AS ELEM2)
12.6.132. xml namespaces ::= Copia collegamentoCollegamento copiato negli appunti!
- XMLNAMESPACES <lparen> <xml namespace element> ( <comma> <xml namespace element> )* <rparen>
Defines XML namespace URI/prefix combinations
Example:
XMLNAMESPACES('http://foo' AS foo)
XMLNAMESPACES('http://foo' AS foo)
12.6.133. xml namespace element ::= Copia collegamentoCollegamento copiato negli appunti!
An xml namespace
Example:
NO DEFAULT
NO DEFAULT
12.6.134. simple data type ::= Copia collegamentoCollegamento copiato negli appunti!
- ( STRING ( <lparen> <unsigned integer> <rparen> )? )
- ( VARCHAR ( <lparen> <unsigned integer> <rparen> )? )
- BOOLEAN
- BYTE
- TINYINT
- SHORT
- SMALLINT
- ( CHAR ( <lparen> <unsigned integer> <rparen> )? )
- INTEGER
- LONG
- BIGINT
- ( BIGINTEGER ( <lparen> <unsigned integer> <rparen> )? )
- FLOAT
- REAL
- DOUBLE
- ( BIGDECIMAL ( <lparen> <unsigned integer> ( <comma> <unsigned integer> )? <rparen> )? )
- ( DECIMAL ( <lparen> <unsigned integer> ( <comma> <unsigned integer> )? <rparen> )? )
- DATE
- TIME
- ( TIMESTAMP ( <lparen> <unsigned integer> <rparen> )? )
- ( OBJECT ( <lparen> <unsigned integer> <rparen> )? )
- ( BLOB ( <lparen> <unsigned integer> <rparen> )? )
- ( CLOB ( <lparen> <unsigned integer> <rparen> )? )
- JSON
- ( VARBINARY ( <lparen> <unsigned integer> <rparen> )? )
- GEOMETRY
- GEOGRAPHY
- XML
A non-collection data type.
Example:
STRING
STRING
12.6.135. basic data type ::= Copia collegamentoCollegamento copiato negli appunti!
- <simple data type> ( <lsbrace> <rsbrace> )*
A data type.
Example:
STRING[]
STRING[]
12.6.136. data type ::= Copia collegamentoCollegamento copiato negli appunti!
- <basic data type>
- ( ( <identifier> | <basicNonReserved> ) ( <lsbrace> <rsbrace> )* )
A data type.
Example:
STRING[]
STRING[]
12.6.137. time interval ::= Copia collegamentoCollegamento copiato negli appunti!
A time interval keyword.
Example:
SQL_TSI_HOUR
SQL_TSI_HOUR
12.6.138. non numeric literal ::= Copia collegamentoCollegamento copiato negli appunti!
An escaped or simple non numeric literal.
Example:
'a'
'a'
12.6.139. unsigned numeric literal ::= Copia collegamentoCollegamento copiato negli appunti!
An unsigned numeric literal value.
Example:
1.234
1.234
12.6.140. ddl statement ::= Copia collegamentoCollegamento copiato negli appunti!
- <create table> ( <create table> | <create procedure> )?
- <option namespace>
- <alterStatement>
- <create trigger>
- <create a domain or type alias>
- <create server>
- <create role >
- <drop role >
- <GRANT>
- <Revoke GRANT>
- <CREATE POLICY>
- <DROP POLICY>
- <drop server>
- <drop table>
- <Import foreign schema>
- <Import another Database>
- <create database>
- <use database>
- <drop schema>
- <set schema>
- <create schema>
- <create procedure> ( <ddl statement> )?
- <create data wrapper>
- <Drop data wrapper>
- <drop procedure>
A data definition statement.
Example:
CREATE FOREIGN TABLE X (Y STRING)
CREATE FOREIGN TABLE X (Y STRING)
12.6.141. option namespace ::= Copia collegamentoCollegamento copiato negli appunti!
- SET NAMESPACE <string> AS <identifier>
A namespace used to shorten the full name of an option key.
Example:
SET NAMESPACE 'http://foo' AS foo
SET NAMESPACE 'http://foo' AS foo
12.6.142. create database ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE DATABASE <identifier> ( VERSION <string> )? ( <options clause> )?
create a new database
Example:
CREATE DATABASE foo OPTIONS(x 'y')
CREATE DATABASE foo OPTIONS(x 'y')
12.6.143. use database ::= Copia collegamentoCollegamento copiato negli appunti!
- USE DATABASE <identifier> ( VERSION <string> )?
database into working context
Example:
USE DATABASE foo
USE DATABASE foo
12.6.144. create schema ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE ( VIRTUAL | FOREIGN )? SCHEMA <identifier> ( SERVER <identifier list> )? ( <options clause> )?
create a schema in database
Example:
CREATE VIRTUAL SCHEMA foo SERVER (s1,s2,s3);
CREATE VIRTUAL SCHEMA foo SERVER (s1,s2,s3);
12.6.145. drop schema ::= Copia collegamentoCollegamento copiato negli appunti!
- DROP ( VIRTUAL | FOREIGN )? SCHEMA <identifier>
drop a schema in database
Example:
DROP SCHEMA foo
DROP SCHEMA foo
12.6.146. set schema ::= Copia collegamentoCollegamento copiato negli appunti!
set the schema for subsequent ddl statements
Example:
SET SCHEMA foo
SET SCHEMA foo
12.6.147. create a domain or type alias ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE DOMAIN ( <identifier> | <basicNonReserved> ) ( AS )? <data type> ( NOT NULL )?
creates a named type with optional constraints
Example:
CREATE DOMAIN my_type AS INTEGER NOT NULL
CREATE DOMAIN my_type AS INTEGER NOT NULL
12.6.148. create data wrapper ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE FOREIGN ( ( DATA WRAPPER ) | TRANSLATOR ) <Unqualified identifier> ( ( TYPE | HANDLER ) <identifier> )? ( <options clause> )?
Defines a translator; use the options to override the translator properties.
Example:
CREATE FOREIGN DATA WRAPPER wrapper OPTIONS (x true)
CREATE FOREIGN DATA WRAPPER wrapper OPTIONS (x true)
12.6.149. Drop data wrapper ::= Copia collegamentoCollegamento copiato negli appunti!
- DROP FOREIGN ( ( DATA WRAPPER ) | TRANSLATOR ) <identifier>
Deletes a translator
Example:
DROP FOREIGN DATA WRAPPER wrapper
DROP FOREIGN DATA WRAPPER wrapper
12.6.150. create role ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE ROLE <Unqualified identifier> ( WITH <with role> )?
Defines data role for the database
Example:
CREATE ROLE lowly WITH FOREIGN ROLE "role"
CREATE ROLE lowly WITH FOREIGN ROLE "role"
12.6.151. with role ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ANY AUTHENTICATED )
- ( ( JAAS | FOREIGN ) ROLE <identifier list> )
12.6.152. drop role ::= Copia collegamentoCollegamento copiato negli appunti!
Removes data role for the database
Example:
DROP ROLE <data-role>
DROP ROLE <data-role>
12.6.153. CREATE POLICY ::= Copia collegamentoCollegamento copiato negli appunti!
CREATE row level policy
Example:
CREATE POLICY pname ON tbl FOR SELECT,INSERT TO role USING col = user();
CREATE POLICY pname ON tbl FOR SELECT,INSERT TO role USING col = user();
12.6.154. DROP POLICY ::= Copia collegamentoCollegamento copiato negli appunti!
- DROP POLICY <identifier> ON ( <identifier> | ( PROCEDURE <identifier> ) ) TO <identifier>
DROP row level policy
Example:
----DROP POLICY pname ON tbl TO role ----
----DROP POLICY pname ON tbl TO role
----
12.6.155. GRANT ::= Copia collegamentoCollegamento copiato negli appunti!
- GRANT ( ( ( <grant type> ( <comma> <grant type> )* )? ON ( TABLE <identifier> ( CONDITION ( ( NOT )? CONSTRAINT )? <string> )? | FUNCTION <identifier> | PROCEDURE <identifier> ( CONDITION ( ( NOT )? CONSTRAINT )? <string> )? | SCHEMA <identifier> | COLUMN <identifier> ( MASK ( ORDER <unsigned integer> )? <string> )? ) ) | ( ALL PRIVILEGES ) | ( TEMPORARY TABLE ) | ( USAGE ON LANGUAGE <identifier> ) ) TO <identifier>
Defines GRANT for a role
Example:
GRANT SELECT ON TABLE x.y TO role
GRANT SELECT ON TABLE x.y TO role
12.6.156. Revoke GRANT ::= Copia collegamentoCollegamento copiato negli appunti!
- REVOKE ( ( ( <grant type> ( <comma> <grant type> )* )? ON ( TABLE <identifier> ( CONDITION )? | FUNCTION <identifier> | PROCEDURE <identifier> ( CONDITION )? | SCHEMA <identifier> | COLUMN <identifier> ( MASK )? ) ) | ( ALL PRIVILEGES ) | ( TEMPORARY TABLE ) | ( USAGE ON LANGUAGE <identifier> ) ) FROM <identifier>
Revokes GRANT for a role
Example:
REVOKE SELECT ON TABLE x.y TO role
REVOKE SELECT ON TABLE x.y TO role
12.6.157. create server ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE SERVER <Unqualified identifier> ( TYPE <string> )? ( VERSION <string> )? FOREIGN ( ( DATA WRAPPER ) | TRANSLATOR ) <Unqualified identifier> ( <options clause> )?
Defines a connection to a source
Example:
CREATE SERVER "h2-connector" FOREIGN DATA WRAPPER h2 OPTIONS ("resource-name" 'java:/accounts-ds');
CREATE SERVER "h2-connector" FOREIGN DATA WRAPPER h2 OPTIONS ("resource-name" 'java:/accounts-ds');
12.6.158. drop server ::= Copia collegamentoCollegamento copiato negli appunti!
Defines dropping connection to foreign source
Example:
DROP SERVER server_name
DROP SERVER server_name
12.6.159. create procedure ::= Copia collegamentoCollegamento copiato negli appunti!
- CREATE ( VIRTUAL | FOREIGN )? ( PROCEDURE | FUNCTION ) <Unqualified identifier> ( <lparen> ( <procedure parameter> ( <comma> <procedure parameter> )* )? <rparen> ( RETURNS ( <options clause> )? ( ( ( TABLE )? <lparen> <procedure result column> ( <comma> <procedure result column> )* <rparen> ) | <data type> ) )? ( <options clause> )? ( AS <statement> )? )
Defines a procedure or function invocation.
Example:
CREATE FOREIGN PROCEDURE proc (param STRING) RETURNS STRING
CREATE FOREIGN PROCEDURE proc (param STRING) RETURNS STRING
12.6.160. drop procedure ::= Copia collegamentoCollegamento copiato negli appunti!
Drops a table or view.
Example:
DROP FOREIGN TABLE table-name
DROP FOREIGN TABLE table-name
12.6.161. procedure parameter ::= Copia collegamentoCollegamento copiato negli appunti!
- ( IN | OUT | INOUT | VARIADIC )? <identifier> <data type> ( NOT NULL )? ( RESULT )? ( DEFAULT <expression> )? ( <options clause> )?
A procedure or function parameter
Example:
OUT x INTEGER
OUT x INTEGER
12.6.162. procedure result column ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> <data type> ( NOT NULL )? ( <options clause> )?
A procedure result column.
Example:
x INTEGER
x INTEGER
12.6.163. create table ::= Copia collegamentoCollegamento copiato negli appunti!
Defines a table or view.
Example:
CREATE VIEW vw AS SELECT 1
CREATE VIEW vw AS SELECT 1
12.6.164. create foreign or global temporary table ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( FOREIGN TABLE ) | ( GLOBAL TEMPORARY TABLE ) ) <Unqualified identifier> <create table body>
Defines a foreign or global temporary table.
Example:
FOREIGN TABLE ft (col integer)
FOREIGN TABLE ft (col integer)
12.6.165. create view ::= Copia collegamentoCollegamento copiato negli appunti!
- ( VIRTUAL )? VIEW <Unqualified identifier> ( <create view body> | ( <options clause> )? ) AS <query expression>
Defines a view.
Example:
VIEW vw AS SELECT 1
VIEW vw AS SELECT 1
12.6.166. drop table ::= Copia collegamentoCollegamento copiato negli appunti!
Drops a table or view.
Example:
DROP VIEW name
DROP VIEW name
12.6.167. create foreign temp table ::= Copia collegamentoCollegamento copiato negli appunti!
Defines a foreign temp table
Example:
CREATE FOREIGN TEMPORARY TABLE t (x string) ON z
CREATE FOREIGN TEMPORARY TABLE t (x string) ON z
12.6.168. create table body ::= Copia collegamentoCollegamento copiato negli appunti!
- <lparen> <table element> ( <comma> ( <table constraint> | <table element> ) )* <rparen> ( <options clause> )?
Defines a table.
Example:
(x string) OPTIONS (CARDINALITY 100)
(x string) OPTIONS (CARDINALITY 100)
12.6.169. create view body ::= Copia collegamentoCollegamento copiato negli appunti!
- <lparen> <view element> ( <comma> ( <table constraint> | <view element> ) )* <rparen> ( <options clause> )?
Defines a view.
Example:
(x) OPTIONS (CARDINALITY 100)
(x) OPTIONS (CARDINALITY 100)
12.6.170. table constraint ::= Copia collegamentoCollegamento copiato negli appunti!
- ( CONSTRAINT <identifier> )? ( <primary key> | <other constraints> | <foreign key> ) ( <options clause> )?
Defines a constraint on a table or view.
Example:
FOREIGN KEY (a, b) REFERENCES tbl (x, y)
FOREIGN KEY (a, b) REFERENCES tbl (x, y)
12.6.171. foreign key ::= Copia collegamentoCollegamento copiato negli appunti!
- FOREIGN KEY <column list> REFERENCES <identifier> ( <column list> )?
Defines the foreign key referential constraint.
Example:
FOREIGN KEY (a, b) REFERENCES tbl (x, y)
FOREIGN KEY (a, b) REFERENCES tbl (x, y)
12.6.172. primary key ::= Copia collegamentoCollegamento copiato negli appunti!
Defines the primary key.
Example:
PRIMARY KEY (a, b)
PRIMARY KEY (a, b)
12.6.173. other constraints ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( UNIQUE | ACCESSPATTERN ) <column list> )
- ( INDEX <lparen> <expression list> <rparen> )
Defines ACCESSPATTERN and UNIQUE constraints and INDEXes.
Example:
UNIQUE (a)
UNIQUE (a)
12.6.174. column list ::= Copia collegamentoCollegamento copiato negli appunti!
- <lparen> <identifier> ( <comma> <identifier> )* <rparen>
A list of column names.
Example:
(a, b)
(a, b)
12.6.175. table element ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( SERIAL | ( <data type> ( NOT NULL )? ( AUTO_INCREMENT )? ) ) <post create column>
Defines a table column.
Example:
x INTEGER NOT NULL
x INTEGER NOT NULL
12.6.176. view element ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( SERIAL | ( <data type> ( NOT NULL )? ( AUTO_INCREMENT )? ) )? <post create column>
Defines a view column with optional type.
Example:
x INTEGER NOT NULL
x INTEGER NOT NULL
12.6.177. post create column ::= Copia collegamentoCollegamento copiato negli appunti!
- ( <inline constraint> )? ( DEFAULT <expression> )? ( <options clause> )?
Common options trailing a column
Example:
PRIMARY KEY
PRIMARY KEY
12.6.178. inline constraint ::= Copia collegamentoCollegamento copiato negli appunti!
Defines a constraint on a single column
Example:
x INTEGER PRIMARY KEY
x INTEGER PRIMARY KEY
12.6.179. options clause ::= Copia collegamentoCollegamento copiato negli appunti!
- OPTIONS <lparen> <option pair> ( <comma> <option pair> )* <rparen>
A list of statement options.
Example:
OPTIONS ('x' 'y', 'a' 'b')
OPTIONS ('x' 'y', 'a' 'b')
12.6.180. option pair ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( <non numeric literal> | ( <plus or minus> )? <unsigned numeric literal> )
An option key/value pair.
Example:
'key' 'value'
'key' 'value'
12.6.181. alter option pair ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( <non numeric literal> | ( <plus or minus> )? <unsigned numeric literal> )
Alter An option key/value pair.
Example:
'key' 'value'
'key' 'value'
12.6.182. alterStatement ::= Copia collegamentoCollegamento copiato negli appunti!
- ALTER ( <ALTER TABLE > | <ALTER PROCEDURE > | <ALTER TRIGGER > | <ALTER SERVER > | <ALTER DATA WRAPPER > | <ALTER DATABASE > )
12.6.183. ALTER TABLE ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( ( VIRTUAL )? VIEW <identifier> ) | ( ( FOREIGN )? TABLE <identifier> ) ) ( ( AS <query expression> ) | <ADD column> | <ADD constraint> | <alter options list> | <DROP column> | ( ALTER COLUMN <alter column options> ) | ( RENAME ( <RENAME Table> | ( COLUMN <rename column options> ) ) ) )
alters options of database
Example:
ALTER TABLE foo ADD COLUMN x xml
ALTER TABLE foo ADD COLUMN x xml
12.6.184. RENAME Table ::= Copia collegamentoCollegamento copiato negli appunti!
- TO <identifier>
alters table name
Example:
ALTER TABLE foo RENAME TO BAR;
ALTER TABLE foo RENAME TO BAR;
12.6.185. ADD constraint ::= Copia collegamentoCollegamento copiato negli appunti!
alters table and adds a constraint
Example:
ADD PRIMARY KEY (ID)
ADD PRIMARY KEY (ID)
12.6.186. ADD column ::= Copia collegamentoCollegamento copiato negli appunti!
alters table and adds a column
Example:
ADD COLUMN bar type OPTIONS (ADD updatable true)
ADD COLUMN bar type OPTIONS (ADD updatable true)
12.6.187. DROP column ::= Copia collegamentoCollegamento copiato negli appunti!
alters table and adds a column
Example:
DROP COLUMN bar
DROP COLUMN bar
12.6.188. alter column options ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( ( TYPE ( SERIAL | ( <data type> ( NOT NULL )? ( AUTO_INCREMENT )? ) ) ) | <alter child options list> )
alters a set of column options
Example:
ALTER COLUMN bar OPTIONS (ADD updatable true)
ALTER COLUMN bar OPTIONS (ADD updatable true)
12.6.189. rename column options ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> TO <identifier>
renames either a table column or procedure’s parameter name
Example:
RENAME COLUMN bar TO foo
RENAME COLUMN bar TO foo
12.6.190. ALTER PROCEDURE ::= Copia collegamentoCollegamento copiato negli appunti!
- ( VIRTUAL | FOREIGN )? PROCEDURE <identifier> ( ( AS <statement> ) | <alter options list> | ( ALTER PARAMETER <alter column options> ) | ( RENAME PARAMETER <rename column options> ) )
alters options of database
Example:
ALTER PROCEDURE foo OPTIONS (ADD x y)
ALTER PROCEDURE foo OPTIONS (ADD x y)
12.6.191. ALTER TRIGGER ::= Copia collegamentoCollegamento copiato negli appunti!
alters options of table triggers
Example:
ALTER TRIGGER ON vw INSTEAD OF INSERT ENABLED
ALTER TRIGGER ON vw INSTEAD OF INSERT ENABLED
12.6.192. ALTER SERVER ::= Copia collegamentoCollegamento copiato negli appunti!
alters options of database
Example:
ALTER SERVER foo OPTIONS (ADD x y)
ALTER SERVER foo OPTIONS (ADD x y)
12.6.193. ALTER DATA WRAPPER ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ( DATA WRAPPER ) | TRANSLATOR ) <identifier> <alter options list>
alters options of data wrapper
Example:
ALTER DATA WRAPPER foo OPTIONS (ADD x y)
ALTER DATA WRAPPER foo OPTIONS (ADD x y)
12.6.194. ALTER DATABASE ::= Copia collegamentoCollegamento copiato negli appunti!
alters options of database
Example:
ALTER DATABASE foo OPTIONS (ADD x y)
ALTER DATABASE foo OPTIONS (ADD x y)
12.6.195. alter options list ::= Copia collegamentoCollegamento copiato negli appunti!
- OPTIONS <lparen> ( <add set option> | <drop option> ) ( <comma> ( <add set option> | <drop option> ) )* <rparen>
a list of alterations to options
Example:
OPTIONS (ADD updatable true)
OPTIONS (ADD updatable true)
12.6.196. drop option ::= Copia collegamentoCollegamento copiato negli appunti!
drop option
Example:
DROP updatable
DROP updatable
12.6.197. add set option ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ADD | SET ) <alter option pair>
add or set an option pair
Example:
ADD updatable true
ADD updatable true
12.6.198. alter child options list ::= Copia collegamentoCollegamento copiato negli appunti!
- OPTIONS <lparen> ( <add set child option> | <drop option> ) ( <comma> ( <add set child option> | <drop option> ) )* <rparen>
a list of alterations to options
Example:
OPTIONS (ADD updatable true)
OPTIONS (ADD updatable true)
12.6.199. drop option ::= Copia collegamentoCollegamento copiato negli appunti!
drop option
Example:
DROP updatable
DROP updatable
12.6.200. add set child option ::= Copia collegamentoCollegamento copiato negli appunti!
- ( ADD | SET ) <alter child option pair>
add or set an option pair
Example:
ADD updatable true
ADD updatable true
12.6.201. alter child option pair ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( <non numeric literal> | ( <plus or minus> )? <unsigned numeric literal> )
Alter An option key/value pair.
Example:
'key' 'value'
'key' 'value'
12.6.202. Import foreign schema ::= Copia collegamentoCollegamento copiato negli appunti!
- IMPORT ( FOREIGN SCHEMA <identifier> )? FROM ( SERVER | REPOSITORY ) <identifier> INTO <identifier> ( <options clause> )?
imports schema metadata from server
Example:
IMPORT FOREIGN SCHEMA foo FROM SERVER bar
IMPORT FOREIGN SCHEMA foo FROM SERVER bar
12.6.203. Import another Database ::= Copia collegamentoCollegamento copiato negli appunti!
imports another database into current database
Example:
IMPORT DATABASE vdb VERSION '1.2.3' WITH ACCESS CONTROL]
IMPORT DATABASE vdb VERSION '1.2.3' WITH ACCESS CONTROL]
12.6.204. identifier list ::= Copia collegamentoCollegamento copiato negli appunti!
- <identifier> ( <comma> <identifier> )*
12.6.205. grant type ::= Copia collegamentoCollegamento copiato negli appunti!